Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MailOnline/ImageViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
kozyty committed Sep 29, 2017
2 parents 0bf31d6 + 29cfd48 commit 2532f74
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode8
osx_image: xcode9
language: objective-c

script:
Expand Down
27 changes: 15 additions & 12 deletions Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -18,7 +22,7 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" image="0" translatesAutoresizingMaskIntoConstraints="NO" id="coc-LS-cRe" customClass="DisplaceableView" customModule="Example" customModuleProvider="target">
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" image="0" translatesAutoresizingMaskIntoConstraints="NO" id="coc-LS-cRe" customClass="DisplaceableView" customModule="ImageViewer">
<rect key="frame" x="16" y="28" width="200" height="102"/>
<gestureRecognizers/>
<constraints>
Expand All @@ -29,7 +33,7 @@
<outletCollection property="gestureRecognizers" destination="EsF-my-zdw" appends="YES" id="EMM-bN-jpd"/>
</connections>
</imageView>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="9" translatesAutoresizingMaskIntoConstraints="NO" id="fu6-tO-ZRV" customClass="DisplaceableView" customModule="Example" customModuleProvider="target">
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="9" translatesAutoresizingMaskIntoConstraints="NO" id="fu6-tO-ZRV" customClass="DisplaceableView" customModule="ImageViewer">
<rect key="frame" x="224" y="28" width="80" height="102"/>
<gestureRecognizers/>
<constraints>
Expand All @@ -39,7 +43,7 @@
<outletCollection property="gestureRecognizers" destination="UGV-jv-W16" appends="YES" id="2MU-vV-yVS"/>
</connections>
</imageView>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="2" translatesAutoresizingMaskIntoConstraints="NO" id="272-lL-lW4" customClass="DisplaceableView" customModule="Example" customModuleProvider="target">
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="2" translatesAutoresizingMaskIntoConstraints="NO" id="272-lL-lW4" customClass="DisplaceableView" customModule="ImageViewer">
<rect key="frame" x="16" y="138" width="127" height="116"/>
<gestureRecognizers/>
<constraints>
Expand All @@ -50,7 +54,7 @@
<outletCollection property="gestureRecognizers" destination="0HP-vJ-viK" appends="YES" id="whT-qN-1rs"/>
</connections>
</imageView>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="3" translatesAutoresizingMaskIntoConstraints="NO" id="9Vs-Br-5DO" customClass="DisplaceableView" customModule="Example" customModuleProvider="target">
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="3" translatesAutoresizingMaskIntoConstraints="NO" id="9Vs-Br-5DO" customClass="DisplaceableView" customModule="ImageViewer">
<rect key="frame" x="151" y="138" width="153" height="116"/>
<gestureRecognizers/>
<constraints>
Expand All @@ -60,7 +64,7 @@
<outletCollection property="gestureRecognizers" destination="slK-TT-Zr2" appends="YES" id="v7L-oa-1cV"/>
</connections>
</imageView>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="8" translatesAutoresizingMaskIntoConstraints="NO" id="JMP-xp-mLE" customClass="DisplaceableView" customModule="Example" customModuleProvider="target">
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="8" translatesAutoresizingMaskIntoConstraints="NO" id="JMP-xp-mLE" customClass="DisplaceableView" customModule="ImageViewer">
<rect key="frame" x="16" y="262" width="161" height="175"/>
<gestureRecognizers/>
<constraints>
Expand All @@ -70,7 +74,7 @@
<outletCollection property="gestureRecognizers" destination="psv-ej-Rbn" appends="YES" id="UsK-Mb-EnH"/>
</connections>
</imageView>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="5" translatesAutoresizingMaskIntoConstraints="NO" id="e0P-yL-Aev" customClass="DisplaceableView" customModule="Example" customModuleProvider="target">
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="5" translatesAutoresizingMaskIntoConstraints="NO" id="e0P-yL-Aev" customClass="DisplaceableView" customModule="ImageViewer">
<rect key="frame" x="185" y="262" width="119" height="175"/>
<gestureRecognizers/>
<constraints>
Expand All @@ -81,15 +85,15 @@
<outletCollection property="gestureRecognizers" destination="bK7-7F-jNM" appends="YES" id="J9h-Ds-YOh"/>
</connections>
</imageView>
<imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="6" translatesAutoresizingMaskIntoConstraints="NO" id="FkF-T8-MIe" customClass="DisplaceableView" customModule="Example" customModuleProvider="target">
<imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="6" translatesAutoresizingMaskIntoConstraints="NO" id="FkF-T8-MIe" customClass="DisplaceableView" customModule="ImageViewer">
<rect key="frame" x="16" y="445" width="288" height="110"/>
<gestureRecognizers/>
<connections>
<outletCollection property="gestureRecognizers" destination="0dc-20-whm" appends="YES" id="iCR-D1-RHn"/>
</connections>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="JMP-xp-mLE" firstAttribute="top" secondItem="9Vs-Br-5DO" secondAttribute="bottom" constant="8" id="3R1-ra-0LG"/>
<constraint firstItem="272-lL-lW4" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="6Ee-Yt-GWf"/>
Expand All @@ -113,7 +117,6 @@
</constraints>
</view>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<simulatedOrientationMetrics key="simulatedOrientationMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="568"/>
<connections>
Expand Down
2 changes: 1 addition & 1 deletion Example/CounterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CounterView: UIView {
let stringTemplate = "%d of %d"
let countString = String(format: stringTemplate, arguments: [currentIndex + 1, count])

countLabel.attributedText = NSAttributedString(string: countString, attributes: [NSFontAttributeName: UIFont.boldSystemFont(ofSize: 17), NSForegroundColorAttributeName: UIColor.white])
countLabel.attributedText = NSAttributedString(string: countString, attributes: [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedStringKey.foregroundColor: UIColor.white])
}

override func layoutSubviews() {
Expand Down
35 changes: 31 additions & 4 deletions ImageViewer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
C7DABE4A1C12245B00F5BD7B /* ImageViewer */,
EB1CEC141C84A4EE00BB27B8 /* ImageViewerTests */,
C7DABE491C12245B00F5BD7B /* Products */,
D72F02FF1F6C02D2009C8A39 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -271,6 +272,13 @@
path = Extensions;
sourceTree = "<group>";
};
D72F02FF1F6C02D2009C8A39 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
EB1CEC141C84A4EE00BB27B8 /* ImageViewerTests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -443,15 +451,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = MailOnline;
TargetAttributes = {
C7897CE11C1350B7006447FB = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
C7DABE471C12245B00F5BD7B = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0900;
};
EB1CEC121C84A4EE00BB27B8 = {
CreatedOnToolsVersion = 7.2.1;
Expand Down Expand Up @@ -636,7 +645,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = mailonline.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -649,7 +659,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = mailonline.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -662,14 +673,20 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_MODULE_DEBUGGING = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -714,14 +731,20 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_MODULE_DEBUGGING = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -766,6 +789,8 @@
PRODUCT_BUNDLE_IDENTIFIER = mailonline.ImageViewer;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -783,6 +808,8 @@
PRODUCT_BUNDLE_IDENTIFIER = mailonline.ImageViewer;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion ImageViewer/Source/Extensions/UIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit

public extension UIViewController {

public func presentImageGallery(_ gallery: GalleryViewController, completion: ((Void) -> Void)? = {}) {
public func presentImageGallery(_ gallery: GalleryViewController, completion: (() -> Void)? = {}) {

present(gallery, animated: false, completion: completion)
}
Expand Down
4 changes: 2 additions & 2 deletions ImageViewer/Source/GalleryDisplacedViewsDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public protocol DisplaceableView {
var center: CGPoint { get }
var boundsCenter: CGPoint { get }
var contentMode: UIViewContentMode { get }
var hidden: Bool { get set }
var isHidden: Bool { get set }

func convertPoint(_ point: CGPoint, toView view: UIView?) -> CGPoint
func convert(_ point: CGPoint, to view: UIView?) -> CGPoint
}

public protocol GalleryDisplacedViewsDataSource: class {
Expand Down
4 changes: 2 additions & 2 deletions ImageViewer/Source/GalleryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ open class GalleryViewController: UIPageViewController, ItemControllerDelegate {
NotificationCenter.default.removeObserver(self)
}

func didEndPlaying() {
@objc func didEndPlaying() {
page(toIndex: currentIndex+1)
}

Expand Down Expand Up @@ -654,7 +654,7 @@ open class GalleryViewController: UIPageViewController, ItemControllerDelegate {
animateDecorationViews(visible: !self.decorationViewsHidden)
}

open func itemControllerDidLongPress(_ controller: ItemController, with item: ItemView) {
open func itemControllerDidLongPress(_ controller: ItemController, in item: ItemView) {
switch (controller, item) {

case (_ as ImageViewController, let item as UIImageView):
Expand Down
Loading

0 comments on commit 2532f74

Please sign in to comment.