Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
hongxinhope committed Oct 17, 2017
1 parent 5bca9e6 commit 3212076
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "onevcat/Kingfisher" "3.10.4"
github "onevcat/Kingfisher" "4.1.1"
24 changes: 19 additions & 5 deletions PhotoBrowser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
4A52D2371C72F568001C257B /* PhotoPreviewController.swift */,
4A87F61E1C96CF63005A9667 /* PBAnimation.swift */,
4A0739981C98FB3C0004FEA5 /* PBCustomView.swift */,
4A52D1E51C72CB2E001C257B /* Info.plist */,
A18117DF1E83B66900F8CE8E /* CustomPhotoBroswerManager.swift */,
4A52D1E51C72CB2E001C257B /* Info.plist */,
);
path = PhotoBrowser;
sourceTree = "<group>";
Expand Down Expand Up @@ -125,12 +125,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Teambition;
TargetAttributes = {
4A52D1DF1C72CB2E001C257B = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -190,14 +190,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 @@ -240,14 +246,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 @@ -296,7 +308,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -319,7 +332,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.Teambition.PhotoBrowser;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
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>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 2 additions & 2 deletions PhotoBrowser.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion PhotoBrowser/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>0.7.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion PhotoBrowser/PBActionBarItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ open class PBActionBarItem: NSObject {
self.action = action
}

func triggerAction() {
@objc func triggerAction() {
guard let photoBrowser = photoBrowser, let action = action else {
return
}
Expand Down
8 changes: 4 additions & 4 deletions PhotoBrowser/PBCustomView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class PBNavigationBar: UIView {

lazy var leftButton: UIButton = {
let button = UIButton()
let image = UIImage(named: "icon-cross", in: Bundle(for: classForCoder()), compatibleWith: nil)
let image = UIImage(named: "icon-cross", in: Bundle(for: classForCoder), compatibleWith: nil)
button.setImage(image, for: UIControlState())
button.translatesAutoresizingMaskIntoConstraints = false
button.addConstraint(NSLayoutConstraint(item: button, attribute: .width, relatedBy: .greaterThanOrEqual, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 40))
Expand All @@ -160,7 +160,7 @@ class PBNavigationBar: UIView {

lazy var moreButton: UIButton = {
let button = UIButton()
var image = UIImage(named: "moreIcon", in: Bundle(for: classForCoder()), compatibleWith: nil)
var image = UIImage(named: "moreIcon", in: Bundle(for: classForCoder), compatibleWith: nil)
button.setImage(image, for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
button.addConstraint(NSLayoutConstraint(item: button, attribute: .width, relatedBy: .greaterThanOrEqual, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 40))
Expand All @@ -171,9 +171,9 @@ class PBNavigationBar: UIView {

lazy var rightButton: UIButton = {
let button = UIButton()
var image = UIImage(named: "icon-share", in: Bundle(for: classForCoder()), compatibleWith: nil)
var image = UIImage(named: "icon-share", in: Bundle(for: classForCoder), compatibleWith: nil)
if self.isFromPhotoPicker {
let unselectedImage = UIImage(named: "checkmark_unselected", in: Bundle(for: classForCoder()), compatibleWith: nil)
let unselectedImage = UIImage(named: "checkmark_unselected", in: Bundle(for: classForCoder), compatibleWith: nil)
image = self.imageSelected ? self.getCheckedSelectedImage() : unselectedImage
}
button.setImage(image, for: .normal)
Expand Down
6 changes: 3 additions & 3 deletions PhotoBrowser/PhotoBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,15 @@ extension PhotoBrowser {
return itemsArray
}

func leftButtonTap(_ sender: AnyObject?) {
@objc func leftButtonTap(_ sender: AnyObject?) {
if let delegate = photoBrowserDelegate {
delegate.dismissPhotoBrowser(self)
} else {
dismissPhotoBrowser()
}
}

func showMoreFiles(_ sender: Any) {
@objc func showMoreFiles(_ sender: Any) {
photoBrowserDelegate?.didShowMoreFiles(self)
}

Expand All @@ -347,7 +347,7 @@ extension PhotoBrowser {
photoBrowserDelegate?.photoBrowser(self, didHideSkitchButton: isSkitchButtonHidden)
}

func rightButtonTap(_ sender: AnyObject) {
@objc func rightButtonTap(_ sender: AnyObject) {
guard let photo = currentPhoto else {
return
}
Expand Down
8 changes: 4 additions & 4 deletions PhotoBrowser/PhotoPreviewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ extension PhotoPreviewController: SkitchViewDelegate {

extension PhotoPreviewController {

func handleDoubleTap(_ sender: UITapGestureRecognizer) {
@objc func handleDoubleTap(_ sender: UITapGestureRecognizer) {
if scrollView.zoomScale != scrollView.minimumZoomScale {
scrollView.setZoomScale(scrollView.minimumZoomScale, animated: true)
} else {
Expand All @@ -406,14 +406,14 @@ extension PhotoPreviewController {
updateConstraint()
}

func handleSingleTap(_ sender: UITapGestureRecognizer) {
@objc func handleSingleTap(_ sender: UITapGestureRecognizer) {
guard let delegate = delegate else {
return
}
delegate.isFullScreenMode = !delegate.isFullScreenMode
}

func handleLongPress(_ sender: UILongPressGestureRecognizer) {
@objc func handleLongPress(_ sender: UILongPressGestureRecognizer) {
guard let delegate = delegate, let photo = photo else {
return
}
Expand All @@ -422,7 +422,7 @@ extension PhotoPreviewController {
}
}

func handleBackgroundSingleTap(_ sender: UITapGestureRecognizer) {
@objc func handleBackgroundSingleTap(_ sender: UITapGestureRecognizer) {
delegate?.didTapOnBackground()
}
}
Expand Down
2 changes: 1 addition & 1 deletion PhotoBrowser/SkitchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SkitchView: UIView {
skitchRectangleButton.tag = PhotoPreviewConstant.skitchButtonTag + index
}

func handleSkitchButtonTap(_ button: UIButton) {
@objc func handleSkitchButtonTap(_ button: UIButton) {
let index = button.tag - PhotoPreviewConstant.skitchButtonTag

UIView.animate(withDuration: 0.15, delay: 0, options: [.curveEaseInOut], animations: {
Expand Down
34 changes: 26 additions & 8 deletions PhotoBrowserDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
4A52D2131C72D13B001C257B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4A52D2121C72D13B001C257B /* Assets.xcassets */; };
4A52D2161C72D13B001C257B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4A52D2141C72D13B001C257B /* LaunchScreen.storyboard */; };
4A8EB7231CEF068D0065EAB0 /* Kingfisher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A6BC7BB1C770DE100DACDA5 /* Kingfisher.framework */; };
869D74FB1F6784CF00765F38 /* PhotoBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86AEF72D1EDEB9D100034DBA /* PhotoBrowser.framework */; };
AC570BBF1E247C550083620C /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC570BBE1E247C550083620C /* DetailViewController.swift */; };
D3F284BF1F96059000E8EE4D /* PhotoBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3F284BE1F96059000E8EE4D /* PhotoBrowser.framework */; };
D3F284C01F96059000E8EE4D /* PhotoBrowser.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D3F284BE1F96059000E8EE4D /* PhotoBrowser.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -24,6 +25,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
D3F284C01F96059000E8EE4D /* PhotoBrowser.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -41,14 +43,15 @@
4A6BC7BB1C770DE100DACDA5 /* Kingfisher.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kingfisher.framework; path = Carthage/Build/iOS/Kingfisher.framework; sourceTree = "<group>"; };
86AEF72D1EDEB9D100034DBA /* PhotoBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PhotoBrowser.framework; path = "../Library/Developer/Xcode/DerivedData/PhotoBrowser-atvddxmpufwrrkfytkysyblmhonv/Build/Products/Debug-iphonesimulator/PhotoBrowser.framework"; sourceTree = "<group>"; };
AC570BBE1E247C550083620C /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
D3F284BE1F96059000E8EE4D /* PhotoBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PhotoBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
4A52D2051C72D13B001C257B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
869D74FB1F6784CF00765F38 /* PhotoBrowser.framework in Frameworks */,
D3F284BF1F96059000E8EE4D /* PhotoBrowser.framework in Frameworks */,
4A8EB7231CEF068D0065EAB0 /* Kingfisher.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -59,6 +62,7 @@
4A52D1FF1C72D13B001C257B = {
isa = PBXGroup;
children = (
D3F284BE1F96059000E8EE4D /* PhotoBrowser.framework */,
4A6BC7BB1C770DE100DACDA5 /* Kingfisher.framework */,
4A52D20A1C72D13B001C257B /* PhotoBrowserDemo */,
4A52D2091C72D13B001C257B /* Products */,
Expand Down Expand Up @@ -125,12 +129,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Teambition;
TargetAttributes = {
4A52D2071C72D13B001C257B = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -223,14 +227,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 @@ -253,7 +263,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -270,14 +280,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 @@ -294,7 +310,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -316,7 +332,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Teambition.PhotoBrowserDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -333,7 +350,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Teambition.PhotoBrowserDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Loading

0 comments on commit 3212076

Please sign in to comment.