From de572698f174d8bda956d536bd681b650c4c83bd Mon Sep 17 00:00:00 2001 From: Sebastian Westemeyer Date: Tue, 15 Jan 2019 23:16:31 +0100 Subject: [PATCH 1/5] Implemented new features: - possibility to change background colour - possibility to hide close button - enable use of storyboard controller instantiation Updated podspec version to 2.0.0 because of incompatible API change. --- Documentation/storyboard.png | Bin 0 -> 21092 bytes Example/ChoiceViewController.swift | 23 ++ Example/EmbeddingViewController.swift | 44 ++++ .../skip_next.imageset/Contents.json | 21 ++ .../baseline_skip_next_white_18dp.png | Bin 0 -> 177 bytes Example/Resources/Base.lproj/Main.storyboard | 197 +++++++++++++++++- Example/ViewController.swift | 2 +- ImageViewer/ImageViewerConfiguration.swift | 8 +- ImageViewer/ImageViewerController.swift | 80 +++++-- ImageViewer/Info.plist | 7 +- .../ImageViewerController.storyboard | 90 ++++++++ .../Resources/ImageViewerController.xib | 80 ------- README.md | 38 +++- SimpleImageViewer.podspec | 6 +- SimpleImageViewer.xcodeproj/project.pbxproj | 22 +- .../xcshareddata/IDEWorkspaceChecks.plist | 8 + 16 files changed, 503 insertions(+), 123 deletions(-) create mode 100644 Documentation/storyboard.png create mode 100644 Example/ChoiceViewController.swift create mode 100644 Example/EmbeddingViewController.swift create mode 100644 Example/Resources/Assets.xcassets/skip_next.imageset/Contents.json create mode 100644 Example/Resources/Assets.xcassets/skip_next.imageset/baseline_skip_next_white_18dp.png create mode 100644 ImageViewer/Resources/ImageViewerController.storyboard delete mode 100644 ImageViewer/Resources/ImageViewerController.xib create mode 100644 SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Documentation/storyboard.png b/Documentation/storyboard.png new file mode 100644 index 0000000000000000000000000000000000000000..c799f836c65b9c4e03ff28c2782d61bcc49ae0bf GIT binary patch literal 21092 zcmeIai96Ka`#+8-OXNk7B2>sOvaiu*&oY(_gBT&}*mn^LC5$oF%0Bje-%@0+7_ukE zXzVkMo%ubdyg#4!@A~}#zw3K_UtL$%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8oK|{4L^)ei=LVZxPg5WR Z1EY9y;W62IeV`i{JYD@<);T3K0RS@OKi2>N literal 0 HcmV?d00001 diff --git a/Example/Resources/Base.lproj/Main.storyboard b/Example/Resources/Base.lproj/Main.storyboard index 7775f5e..3cce1a6 100644 --- a/Example/Resources/Base.lproj/Main.storyboard +++ b/Example/Resources/Base.lproj/Main.storyboard @@ -1,18 +1,19 @@ - + - + + - + @@ -24,7 +25,7 @@ - + @@ -47,12 +48,12 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/ViewController.swift b/Example/ViewController.swift index ccdc911..b9e3489 100644 --- a/Example/ViewController.swift +++ b/Example/ViewController.swift @@ -45,7 +45,7 @@ class ViewController: UICollectionViewController, UICollectionViewDelegateFlowLa config.imageView = cell.imageView } - present(ImageViewerController(configuration: configuration), animated: true) + present(ImageViewerController.imageViewerController(configuration: configuration), animated: true) } override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { diff --git a/ImageViewer/ImageViewerConfiguration.swift b/ImageViewer/ImageViewerConfiguration.swift index 0084f02..f463274 100644 --- a/ImageViewer/ImageViewerConfiguration.swift +++ b/ImageViewer/ImageViewerConfiguration.swift @@ -8,10 +8,12 @@ public final class ImageViewerConfiguration { public var image: UIImage? public var imageView: UIImageView? public var imageBlock: ImageBlock? - + public var showCloseButton: Bool = true + public var backgroundColor: UIColor? + public typealias ConfigurationClosure = (ImageViewerConfiguration) -> () - public init(configurationClosure: ConfigurationClosure) { - configurationClosure(self) + public init(configurationClosure: ConfigurationClosure?) { + configurationClosure?(self) } } diff --git a/ImageViewer/ImageViewerController.swift b/ImageViewer/ImageViewerController.swift index 9634125..040fd9f 100644 --- a/ImageViewer/ImageViewerController.swift +++ b/ImageViewer/ImageViewerController.swift @@ -5,35 +5,63 @@ public final class ImageViewerController: UIViewController { @IBOutlet fileprivate var scrollView: UIScrollView! @IBOutlet fileprivate var imageView: UIImageView! @IBOutlet fileprivate var activityIndicator: UIActivityIndicatorView! - + @IBOutlet fileprivate var closeButton: UIButton! + fileprivate var transitionHandler: ImageViewerTransitioningHandler? - fileprivate let configuration: ImageViewerConfiguration? + public var configuration: ImageViewerConfiguration? public override var prefersStatusBarHidden: Bool { return true } - public init(configuration: ImageViewerConfiguration?) { - self.configuration = configuration - super.init(nibName: String(describing: type(of: self)), bundle: Bundle(for: type(of: self))) - - modalPresentationStyle = .overFullScreen - modalTransitionStyle = .crossDissolve - modalPresentationCapturesStatusBarAppearance = true + public static func imageViewerController(configuration: ImageViewerConfiguration?) -> ImageViewerController { + let storyboard = UIStoryboard(name: "ImageViewerController", bundle: nil) + let viewController = storyboard.instantiateViewController(withIdentifier: "ImageViewerController") as! ImageViewerController + viewController.configuration = configuration + return viewController } required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + super.init(coder: aDecoder) + + modalPresentationStyle = .overFullScreen + modalTransitionStyle = .crossDissolve + modalPresentationCapturesStatusBarAppearance = true } - + override public func viewDidLoad() { super.viewDidLoad() - imageView.image = configuration?.imageView?.image ?? configuration?.image - + + guard let config = configuration else { + fatalError("configuration has not been set") + } + + if !config.showCloseButton { + closeButton.isHidden = true + } + + loadImage() + setupScrollView() setupGestureRecognizers() setupTransitions() - setupActivityIndicator() + + if let color = configuration?.backgroundColor { + view.setBackgroundColors(color) + } + } + + override public func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + resetZoomScale() + } + + public func reloadImage() { + resetZoomScale() + loadImage() + } + + public func resetZoomScale() { + scrollView.zoomScale = scrollView.minimumZoomScale } } @@ -57,7 +85,24 @@ extension ImageViewerController: UIGestureRecognizerDelegate { } } +private extension UIView { + func setBackgroundColors(_ color: UIColor) { + for subview in subviews { + subview.backgroundColor = .clear + } + backgroundColor = color + } +} + private extension ImageViewerController { + func loadImage() { + if configuration?.imageBlock == nil { + imageView.image = configuration?.imageView?.image ?? configuration?.image + } else { + setupActivityIndicator() + } + } + func setupScrollView() { scrollView.decelerationRate = UIScrollView.DecelerationRate.fast scrollView.alwaysBounceVertical = true @@ -86,10 +131,11 @@ private extension ImageViewerController { guard let block = configuration?.imageBlock else { return } activityIndicator.startAnimating() block { [weak self] image in - guard let image = image else { return } DispatchQueue.main.async { self?.activityIndicator.stopAnimating() - self?.imageView.image = image + if image != nil { + self?.imageView.image = image + } } } } @@ -118,7 +164,7 @@ private extension ImageViewerController { @objc func imageViewPanned(_ recognizer: UIPanGestureRecognizer) { guard transitionHandler != nil else { return } - + let translation = recognizer.translation(in: imageView) let velocity = recognizer.velocity(in: imageView) diff --git a/ImageViewer/Info.plist b/ImageViewer/Info.plist index a246732..80dab99 100644 --- a/ImageViewer/Info.plist +++ b/ImageViewer/Info.plist @@ -27,7 +27,12 @@ UIStatusBarStyle UIStatusBarStyleLightContent UISupportedInterfaceOrientations - + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + UIViewControllerBasedStatusBarAppearance diff --git a/ImageViewer/Resources/ImageViewerController.storyboard b/ImageViewer/Resources/ImageViewerController.storyboard new file mode 100644 index 0000000..f0d22ef --- /dev/null +++ b/ImageViewer/Resources/ImageViewerController.storyboard @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ImageViewer/Resources/ImageViewerController.xib b/ImageViewer/Resources/ImageViewerController.xib deleted file mode 100644 index 07595fc..0000000 --- a/ImageViewer/Resources/ImageViewerController.xib +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/README.md b/README.md index f70ab65..1b13586 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![SimpleImageViewer](https://github.com/aFrogleap/SimpleImageViewer/blob/development/Documentation/banner.png) +![SimpleImageViewer](https://github.com/aFrogleap/SimpleImageViewer/raw/development/Documentation/banner.png) [![CI Status](https://travis-ci.org/aFrogleap/SimpleImageViewer.svg?branch=master)](https://travis-ci.org/aFrogleap/SimpleImageViewer) [![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)](https://developer.apple.com/swift/) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) @@ -7,7 +7,7 @@ A snappy image viewer with zoom and interactive dismissal transition. -![SimpleImageViewer](https://github.com/aFrogleap/SimpleImageViewer/blob/development/Documentation/example.gif) +![SimpleImageViewer](https://github.com/aFrogleap/SimpleImageViewer/raw/development/Documentation/example.gif) ## Features @@ -24,7 +24,7 @@ A snappy image viewer with zoom and interactive dismissal transition. To install SimpleImageViewer into your Xcode project using [Carthage](https://github.com/Carthage/Carthage), specify it in your `Cartfile`: ```ogdl -github "aFrogleap/SimpleImageViewer" ~> 1.1.1 +github "aFrogleap/SimpleImageViewer" ~> 2.0.0 ``` ### Cocoapods @@ -32,7 +32,7 @@ github "aFrogleap/SimpleImageViewer" ~> 1.1.1 To install SimpleImageViewer into your Xcode project using [CocoaPods](http://cocoapods.org), specify it in your `Podfile`: ```ruby -pod 'SimpleImageViewer', '~> 1.1.1' +pod 'SimpleImageViewer', '~> 2.0.0' ``` ### Swift Package Manager @@ -46,15 +46,39 @@ dependencies: [ ``` ## Sample Usage + +See the example app to find out about how to customise things like background colour, how to hide the close button and how to interact with the view controller to switch images. + +### Create programmatically ```swift let configuration = ImageViewerConfiguration { config in config.imageView = someImageView } -let imageViewerController = ImageViewerController(configuration: configuration) +let imageViewerController = ImageViewerController.imageViewController(configuration: configuration) present(imageViewerController, animated: true) +``` +### Create from storyboard +First step is to place a new storyboard reference on your app's storyboard using "ImageViewerController" as `Storyboard` and "ImageViewerController" as `Referenced ID`. After that, you can connect your segue to that reference (either directly or using `embed` segues for container views). + +![SimpleImageViewer](https://github.com/aFrogleap/SimpleImageViewer/raw/development/Documentation/storyboard.png) + +To configure your new view controller you then simply add the following code (using your segue's ID as a constant): + +```swift +override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if(segue.identifier == "showSingleImage") { + let destination = segue.destination as! ImageViewerController + let configuration = ImageViewerConfiguration { config in + config.image = UIImage(named: "2") + } + configuration.showCloseButton = false + destination.configuration = configuration + } +} + ``` ## Communication @@ -62,6 +86,10 @@ present(imageViewerController, animated: true) - If you **have a feature request**, open an issue. - If you **want to contribute**, submit a pull request. +## Apps Using SimpleImageViewer + +- [Toeppersee](https://itunes.apple.com/de/app/toeppersee/id793480458?mt=8) by Sebastian Westemeyer + ## License SimpleImageViewer is available under the MIT license. See the LICENSE file for more info. diff --git a/SimpleImageViewer.podspec b/SimpleImageViewer.podspec index 4e45dc6..ca4e44c 100644 --- a/SimpleImageViewer.podspec +++ b/SimpleImageViewer.podspec @@ -1,16 +1,16 @@ Pod::Spec.new do |s| s.platform = :ios s.ios.deployment_target = '8.0' + s.swift_version = "4.2" s.name = "SimpleImageViewer" s.summary = "A snappy image viewer with zoom and interactive dismissal transition." s.requires_arc = true - s.version = "1.1.1" + s.version = "2.0.0" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Lucas" => "lucas@afrogleap.com" } s.homepage = "https://github.com/aFrogleap/SimpleImageViewer" s.source = { :git => "https://github.com/aFrogleap/SimpleImageViewer.git", :tag => s.version.to_s } s.source_files = "ImageViewer/**/*.{swift}" - s.resources = ["ImageViewer/**/*.{xib}", "ImageViewer/**/*.{xcassets}"] - + s.resources = ["ImageViewer/**/*.{storyboard}", "ImageViewer/**/*.{xcassets}"] end diff --git a/SimpleImageViewer.xcodeproj/project.pbxproj b/SimpleImageViewer.xcodeproj/project.pbxproj index a918b3c..bc3aab7 100644 --- a/SimpleImageViewer.xcodeproj/project.pbxproj +++ b/SimpleImageViewer.xcodeproj/project.pbxproj @@ -26,9 +26,12 @@ A0BF70B71EDC758300109F6E /* ImageViewerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A07E76EB1ECC94EA00B77D46 /* ImageViewerController.swift */; }; A0BF70B81EDC758300109F6E /* AnimatableImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A07E771F1ECE390C00B77D46 /* AnimatableImageView.swift */; }; A0BF70B91EDC759A00109F6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A07E76DA1ECC94A400B77D46 /* Main.storyboard */; }; - A0BF70BA1EDC75AE00109F6E /* ImageViewerController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A07E76ED1ECC959700B77D46 /* ImageViewerController.xib */; }; A0BF70BB1EDC75AE00109F6E /* ImageViewer-Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A07E77231ECF289800B77D46 /* ImageViewer-Assets.xcassets */; }; A0BF70BC1EDC767B00109F6E /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A07E77211ECF1FC100B77D46 /* HeaderView.swift */; }; + D3C7594821DA49D000193585 /* ImageViewer-Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A07E77231ECF289800B77D46 /* ImageViewer-Assets.xcassets */; }; + D3DB732621C2EE0F007D3809 /* ChoiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3DB732521C2EE0F007D3809 /* ChoiceViewController.swift */; }; + D3DB732821C2F2DF007D3809 /* EmbeddingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3DB732721C2F2DF007D3809 /* EmbeddingViewController.swift */; }; + D3DB732A21C2F719007D3809 /* ImageViewerController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3DB732921C2F719007D3809 /* ImageViewerController.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -70,7 +73,6 @@ A07E76DB1ECC94A400B77D46 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; A07E76DD1ECC94A400B77D46 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; A07E76EB1ECC94EA00B77D46 /* ImageViewerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageViewerController.swift; sourceTree = ""; }; - A07E76ED1ECC959700B77D46 /* ImageViewerController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ImageViewerController.xib; path = Resources/ImageViewerController.xib; sourceTree = ""; }; A07E77161ECE0F3500B77D46 /* ImageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCell.swift; sourceTree = ""; }; A07E77191ECE2EDF00B77D46 /* ImageViewerPresentationTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageViewerPresentationTransition.swift; sourceTree = ""; }; A07E771B1ECE313E00B77D46 /* ImageViewerTransitioningHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageViewerTransitioningHandler.swift; sourceTree = ""; }; @@ -81,6 +83,9 @@ A08B781B1EF1674200F8C5BC /* ImageViewerDismissalInteractor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageViewerDismissalInteractor.swift; sourceTree = ""; }; A0BF70A71EDC5B1400109F6E /* SimpleImageViewer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SimpleImageViewer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A0BF70A91EDC5B1400109F6E /* ImageViewer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageViewer.h; sourceTree = ""; }; + D3DB732521C2EE0F007D3809 /* ChoiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChoiceViewController.swift; sourceTree = ""; }; + D3DB732721C2F2DF007D3809 /* EmbeddingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmbeddingViewController.swift; sourceTree = ""; }; + D3DB732921C2F719007D3809 /* ImageViewerController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = ImageViewerController.storyboard; path = Resources/ImageViewerController.storyboard; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -166,6 +171,8 @@ A07E77211ECF1FC100B77D46 /* HeaderView.swift */, A07E77161ECE0F3500B77D46 /* ImageCell.swift */, A07E76D81ECC94A400B77D46 /* ViewController.swift */, + D3DB732521C2EE0F007D3809 /* ChoiceViewController.swift */, + D3DB732721C2F2DF007D3809 /* EmbeddingViewController.swift */, ); path = Example; sourceTree = ""; @@ -186,7 +193,7 @@ children = ( A05E9FA41EF7FB640024CF47 /* ImageViewerConfiguration.swift */, A07E76EB1ECC94EA00B77D46 /* ImageViewerController.swift */, - A07E76ED1ECC959700B77D46 /* ImageViewerController.xib */, + D3DB732921C2F719007D3809 /* ImageViewerController.storyboard */, ); name = ImageViewerController; sourceTree = ""; @@ -334,6 +341,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D3C7594821DA49D000193585 /* ImageViewer-Assets.xcassets in Resources */, + D3DB732A21C2F719007D3809 /* ImageViewerController.storyboard in Resources */, A0BF70B91EDC759A00109F6E /* Main.storyboard in Resources */, A07E76DE1ECC94A400B77D46 /* Assets.xcassets in Resources */, ); @@ -343,7 +352,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - A0BF70BA1EDC75AE00109F6E /* ImageViewerController.xib in Resources */, A0BF70BB1EDC75AE00109F6E /* ImageViewer-Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -366,6 +374,8 @@ files = ( A07E76D91ECC94A400B77D46 /* ViewController.swift in Sources */, A07E77171ECE0F3500B77D46 /* ImageCell.swift in Sources */, + D3DB732821C2F2DF007D3809 /* EmbeddingViewController.swift in Sources */, + D3DB732621C2EE0F007D3809 /* ChoiceViewController.swift in Sources */, A07E76D71ECC94A400B77D46 /* AppDelegate.swift in Sources */, A0BF70BC1EDC767B00109F6E /* HeaderView.swift in Sources */, ); @@ -548,7 +558,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEVELOPMENT_TEAM = 44MAY72KU6; INFOPLIST_FILE = "$(SRCROOT)/ImageViewer/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleapbv.inhouse.swift.imageviewer; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -566,7 +576,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/ImageViewer/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleapbv.inhouse.swift.imageviewer; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SimpleImageViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + From b3b8a7f09134602ed73ebd45bde4d02268280a69 Mon Sep 17 00:00:00 2001 From: Sebastian Westemeyer Date: Tue, 15 Jan 2019 23:17:03 +0100 Subject: [PATCH 2/5] Modified README.md. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1b13586..642a7a8 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ override func prepare(for segue: UIStoryboardSegue, sender: Any?) { } ``` +Storyboard references need a deployment target of at least iOS 9. ## Communication - If you **found a bug**, open an issue. From 7a7168496c2c85e917f5bc02284f06214df544ad Mon Sep 17 00:00:00 2001 From: Sebastian Westemeyer Date: Tue, 15 Jan 2019 23:19:23 +0100 Subject: [PATCH 3/5] Updated image reference. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 642a7a8..4ef7874 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ present(imageViewerController, animated: true) ### Create from storyboard First step is to place a new storyboard reference on your app's storyboard using "ImageViewerController" as `Storyboard` and "ImageViewerController" as `Referenced ID`. After that, you can connect your segue to that reference (either directly or using `embed` segues for container views). -![SimpleImageViewer](https://github.com/aFrogleap/SimpleImageViewer/raw/development/Documentation/storyboard.png) +![Storyboard](https://raw.githubusercontent.com/swesteme/SimpleImageViewer/master/Documentation/storyboard.png) To configure your new view controller you then simply add the following code (using your segue's ID as a constant): From 3c04b6c1615bed1d72cfd82d84c6285ac0f90245 Mon Sep 17 00:00:00 2001 From: Sebastian Westemeyer Date: Tue, 22 Jan 2019 23:12:10 +0100 Subject: [PATCH 4/5] Incremented iOS deployment target because of safe area layout guides in storyboard. --- SimpleImageViewer.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimpleImageViewer.podspec b/SimpleImageViewer.podspec index ca4e44c..3c55c2d 100644 --- a/SimpleImageViewer.podspec +++ b/SimpleImageViewer.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.platform = :ios - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.0' s.swift_version = "4.2" s.name = "SimpleImageViewer" s.summary = "A snappy image viewer with zoom and interactive dismissal transition." From aa0dd189ea525d0cff30db9fa659df75e99e180e Mon Sep 17 00:00:00 2001 From: Sebastian Westemeyer Date: Thu, 28 Feb 2019 17:30:22 +0100 Subject: [PATCH 5/5] Fixed problem when referencing ImageViewerController from storyboard file. --- Example/Resources/Base.lproj/Main.storyboard | 2 +- ImageViewer/ImageViewerController.swift | 2 +- SimpleImageViewer.xcodeproj/project.pbxproj | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Example/Resources/Base.lproj/Main.storyboard b/Example/Resources/Base.lproj/Main.storyboard index 3cce1a6..aff4553 100644 --- a/Example/Resources/Base.lproj/Main.storyboard +++ b/Example/Resources/Base.lproj/Main.storyboard @@ -205,7 +205,7 @@ - + diff --git a/ImageViewer/ImageViewerController.swift b/ImageViewer/ImageViewerController.swift index 040fd9f..8db3d9c 100644 --- a/ImageViewer/ImageViewerController.swift +++ b/ImageViewer/ImageViewerController.swift @@ -15,7 +15,7 @@ public final class ImageViewerController: UIViewController { } public static func imageViewerController(configuration: ImageViewerConfiguration?) -> ImageViewerController { - let storyboard = UIStoryboard(name: "ImageViewerController", bundle: nil) + let storyboard = UIStoryboard(name: "ImageViewerController", bundle: Bundle(for: ImageViewerController.self)) let viewController = storyboard.instantiateViewController(withIdentifier: "ImageViewerController") as! ImageViewerController viewController.configuration = configuration return viewController diff --git a/SimpleImageViewer.xcodeproj/project.pbxproj b/SimpleImageViewer.xcodeproj/project.pbxproj index bc3aab7..bdd07e0 100644 --- a/SimpleImageViewer.xcodeproj/project.pbxproj +++ b/SimpleImageViewer.xcodeproj/project.pbxproj @@ -28,10 +28,10 @@ A0BF70B91EDC759A00109F6E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A07E76DA1ECC94A400B77D46 /* Main.storyboard */; }; A0BF70BB1EDC75AE00109F6E /* ImageViewer-Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A07E77231ECF289800B77D46 /* ImageViewer-Assets.xcassets */; }; A0BF70BC1EDC767B00109F6E /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A07E77211ECF1FC100B77D46 /* HeaderView.swift */; }; + D31D3CE62227C70100277194 /* ImageViewerController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3DB732921C2F719007D3809 /* ImageViewerController.storyboard */; }; D3C7594821DA49D000193585 /* ImageViewer-Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A07E77231ECF289800B77D46 /* ImageViewer-Assets.xcassets */; }; D3DB732621C2EE0F007D3809 /* ChoiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3DB732521C2EE0F007D3809 /* ChoiceViewController.swift */; }; D3DB732821C2F2DF007D3809 /* EmbeddingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3DB732721C2F2DF007D3809 /* EmbeddingViewController.swift */; }; - D3DB732A21C2F719007D3809 /* ImageViewerController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3DB732921C2F719007D3809 /* ImageViewerController.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -342,7 +342,6 @@ buildActionMask = 2147483647; files = ( D3C7594821DA49D000193585 /* ImageViewer-Assets.xcassets in Resources */, - D3DB732A21C2F719007D3809 /* ImageViewerController.storyboard in Resources */, A0BF70B91EDC759A00109F6E /* Main.storyboard in Resources */, A07E76DE1ECC94A400B77D46 /* Assets.xcassets in Resources */, ); @@ -352,6 +351,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D31D3CE62227C70100277194 /* ImageViewerController.storyboard in Resources */, A0BF70BB1EDC75AE00109F6E /* ImageViewer-Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -598,7 +598,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/ImageViewer/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleap.ImageViewer; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -622,7 +622,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/ImageViewer/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.afrogleap.ImageViewer; PRODUCT_NAME = "$(TARGET_NAME)";