Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Swift 4 and Xcode 9 #25

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ matrix:
exclude:
- os: osx
include:
- osx_image: xcode8
- osx_image: xcode9.2
env:
- XCODE_ACTION="clean test"
XCODE_TOOLCHAIN="swift"
XCODE_DESTINATION="platform=iOS Simulator,id=237D7619-4A4E-4624-8925-67A42A8A690A"
XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 6s"
- osx_image: xcode8
env:
- JOB=CARTHAGE
Expand All @@ -26,7 +26,7 @@ matrix:
- brew outdated carthage || brew upgrade carthage
- carthage build --no-skip-current
- test -d Carthage/Build/iOS/RIGImageGallery.framework || exit 1
- osx_image: xcode8
- osx_image: xcode9.2
env:
- JOB=COCOAPODS
script:
Expand Down
2 changes: 1 addition & 1 deletion gemfile → Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://rubygems.org"

gem 'cocoapods', '~> 1.1'
gem 'cocoapods', '1.4.0'
61 changes: 31 additions & 30 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,73 +1,74 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.5)
activesupport (4.2.8)
CFPropertyList (2.3.6)
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
claide (1.0.1)
cocoapods (1.2.0)
claide (1.0.2)
cocoapods (1.4.0)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.1, < 2.0)
cocoapods-core (= 1.2.0)
cocoapods-deintegrate (>= 1.0.1, < 2.0)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.4.0)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.1.3, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.1.2, < 2.0)
cocoapods-trunk (>= 1.3.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored (~> 1.2)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.5.5)
molinillo (~> 0.6.4)
nap (~> 1.0)
ruby-macho (~> 0.2.5)
xcodeproj (>= 1.4.1, < 2.0)
cocoapods-core (1.2.0)
activesupport (>= 4.0.2, < 5)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.4, < 2.0)
cocoapods-core (1.4.0)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.1)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.1.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.1.2)
cocoapods-trunk (1.3.0)
nap (>= 0.8, < 2.0)
netrc (= 0.7.8)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored (1.2)
colored2 (3.1.2)
concurrent-ruby (1.0.5)
escape (0.0.4)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.0.3)
i18n (0.8.1)
minitest (5.10.1)
molinillo (0.5.6)
i18n (0.9.3)
concurrent-ruby (~> 1.0)
minitest (5.11.1)
molinillo (0.6.4)
nanaimo (0.2.3)
nap (1.1.0)
netrc (0.7.8)
ruby-macho (0.2.6)
netrc (0.11.0)
ruby-macho (1.1.0)
thread_safe (0.3.6)
tzinfo (1.2.2)
tzinfo (1.2.4)
thread_safe (~> 0.1)
xcodeproj (1.4.2)
xcodeproj (1.5.4)
CFPropertyList (~> 2.3.3)
activesupport (>= 3)
claide (>= 1.0.1, < 2.0)
colored (~> 1.2)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.1)
cocoapods (= 1.4.0)

BUNDLED WITH
1.14.5
1.16.0
3 changes: 2 additions & 1 deletion RIGImageGallery.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Pod::Spec.new do |s|
s.name = "RIGImageGallery"
s.version = "0.3.1"
s.summary = "An image gallery view controller designed to work with the Raizlabs Interface Guidelines for iOS."
s.swift_version = "4.0"

s.description = <<-DESC
RIGImageGallery is an image gallery for iOS written in Swift.
Expand All @@ -17,7 +18,7 @@ Pod::Spec.new do |s|

s.ios.deployment_target = '9.0'

s.source_files = 'RIGImageGallery', 'RIGImageGallery/**/*'
s.source_files = 'RIGImageGallery', 'RIGImageGallery/**/*.swift'

s.frameworks = 'Foundation', 'UIKit'

Expand Down
29 changes: 18 additions & 11 deletions RIGImageGallery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0810;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = Raizlabs;
TargetAttributes = {
72060F4F1D2FFA6C001281E0 = {
Expand All @@ -343,12 +343,12 @@
72A828081C68F24500B25CEE = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = 336S848KQ4;
LastSwiftMigration = 0810;
LastSwiftMigration = 0920;
};
72BA26511C6B985900F1FE22 = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = 336S848KQ4;
LastSwiftMigration = 0810;
LastSwiftMigration = 0920;
};
};
};
Expand Down Expand Up @@ -519,7 +519,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.raizlabs.RIGImageGalleryTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -532,7 +531,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.raizlabs.RIGImageGalleryTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -548,7 +546,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.raizlabs.RIGImageGalleryDemoUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 3.0;
TEST_TARGET_NAME = RIGImageGalleryDemo;
};
name = Debug;
Expand All @@ -564,7 +561,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.raizlabs.RIGImageGalleryDemoUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_TARGET_NAME = RIGImageGalleryDemo;
};
name = Release;
Expand All @@ -577,14 +573,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
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 @@ -613,6 +615,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -627,14 +630,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
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 All @@ -656,6 +665,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -676,7 +686,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.raizlabs.RigImageGalleryDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -693,7 +702,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.raizlabs.RigImageGalleryDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -714,7 +722,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -734,7 +741,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.raizlabs.RIGImageGallery;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -757,6 +763,7 @@
722523701E3276F300D50D16 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
72A827F31C68F17900B25CEE /* Build configuration list for PBXProject "RIGImageGallery" */ = {
isa = XCConfigurationList;
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 = "0810"
LastUpgradeVersion = "0920"
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"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -56,6 +57,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
17 changes: 9 additions & 8 deletions RIGImageGallery/RIGImageGalleryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ open class RIGImageGalleryViewController: UIPageViewController {
self.images = images
}

public override init(transitionStyle style: UIPageViewControllerTransitionStyle, navigationOrientation: UIPageViewControllerNavigationOrientation, options: [String : Any]?) {
public override init(transitionStyle style: UIPageViewControllerTransitionStyle, navigationOrientation: UIPageViewControllerNavigationOrientation, options: [String: Any]?) {
super.init(transitionStyle: style, navigationOrientation: navigationOrientation, options: options)
dataSource = self
delegate = self
Expand Down Expand Up @@ -213,16 +213,16 @@ extension RIGImageGalleryViewController: UIGestureRecognizerDelegate {

extension RIGImageGalleryViewController {

func toggleBarVisiblity(_ recognizer: UITapGestureRecognizer) {
@objc func toggleBarVisiblity(_ recognizer: UITapGestureRecognizer) {
navigationBarsHidden = !navigationBarsHidden
updateBarStatus(animated: true)
}

func toggleZoom(_ recognizer: UITapGestureRecognizer) {
@objc func toggleZoom(_ recognizer: UITapGestureRecognizer) {
currentImageViewController?.scrollView.toggleZoom()
}

func dismissPhotoView(_ sender: UIBarButtonItem) {
@objc func dismissPhotoView(_ sender: UIBarButtonItem) {
if dismissHandler != nil {
dismissHandler?(self)
}
Expand All @@ -231,7 +231,7 @@ extension RIGImageGalleryViewController {
}
}

func performAction(_ sender: UIBarButtonItem) {
@objc func performAction(_ sender: UIBarButtonItem) {
if let item = currentImageViewController?.viewerItem {
actionButtonHandler?(self, item)
}
Expand Down Expand Up @@ -310,9 +310,10 @@ private extension RIGImageGalleryViewController {
for viewController in childViewControllers {
if let index = indexOf(viewController: viewController, imagesArray: oldValue),
let childView = viewController as? RIGSingleImageViewController, index < images.count {
DispatchQueue.main.async { [unowned self] in
childView.viewerItem = self.images[index]
childView.scrollView.baseInsets = self.scrollViewInset
DispatchQueue.main.async { [weak self] in
guard let strongSelf = self else { return }
childView.viewerItem = strongSelf.images[index]
childView.scrollView.baseInsets = strongSelf.scrollViewInset
}
}
}
Expand Down
1 change: 0 additions & 1 deletion RIGImageGalleryDemo/View Controller/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ private extension ViewController {
}

private extension RIGImageGalleryViewController {
// swiftlint:disable:next large_tuple
func handleImageLoadAtIndex(_ index: Int) -> ((Data?, URLResponse?, Error?) -> Void) {
return { [weak self] (data: Data?, response: URLResponse?, error: Error?) in
guard let image = data.flatMap(UIImage.init), error == nil else {
Expand Down
Loading