From 7cf1ecd220b152051486dad4489fdfcfc19905b1 Mon Sep 17 00:00:00 2001 From: Xin Hong Date: Tue, 17 Oct 2017 16:51:30 +0800 Subject: [PATCH] swift 4 --- Cartfile.resolved | 4 +-- PhotoPicker.xcodeproj/project.pbxproj | 24 +++++++++---- .../xcschemes/PhotoPicker.xcscheme | 4 ++- PhotoPicker/AlbumsViewController.swift | 7 +--- PhotoPicker/AssetCell.swift | 2 +- PhotoPicker/AssetsViewController.swift | 4 +-- PhotoPicker/Info.plist | 2 +- PhotoPicker/PhotoPicker.storyboard | 18 +++++----- PhotoPicker/PhotoPickerThemeManager.swift | 2 +- PhotoPicker/ToolBarHighQualityButton.swift | 2 +- PhotoPickerDemo.xcodeproj/project.pbxproj | 36 ++++++++++++++----- .../AppIcon.appiconset/Contents.json | 15 ++++++++ .../Base.lproj/LaunchScreen.storyboard | 16 +++++---- PhotoPickerDemo/Base.lproj/Main.storyboard | 12 +++---- PhotoPickerDemo/Info.plist | 6 ++-- PhotoPickerDemo/ViewController.swift | 3 -- 16 files changed, 100 insertions(+), 57 deletions(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index 95977a7..c8d01e0 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "onevcat/Kingfisher" "3.2.2" -github "teambition/PhotoBrowser" "0.5.8" +github "onevcat/Kingfisher" "4.1.1" +github "teambition/PhotoBrowser" "0.7.0" diff --git a/PhotoPicker.xcodeproj/project.pbxproj b/PhotoPicker.xcodeproj/project.pbxproj index b9a2622..c1d40ae 100644 --- a/PhotoPicker.xcodeproj/project.pbxproj +++ b/PhotoPicker.xcodeproj/project.pbxproj @@ -193,12 +193,12 @@ EBA70ACD1C7EA9320089ECD7 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = StormXX; TargetAttributes = { EBA70AD51C7EA9320089ECD7 = { CreatedOnToolsVersion = 7.2.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; }; }; @@ -265,14 +265,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; @@ -315,14 +321,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; @@ -366,13 +378,13 @@ ); INFOPLIST_FILE = PhotoPicker/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.StormXX.PhotoPicker; 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; }; @@ -391,12 +403,12 @@ ); INFOPLIST_FILE = PhotoPicker/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.StormXX.PhotoPicker; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/PhotoPicker.xcodeproj/xcshareddata/xcschemes/PhotoPicker.xcscheme b/PhotoPicker.xcodeproj/xcshareddata/xcschemes/PhotoPicker.xcscheme index b6b7a3f..350ae9e 100644 --- a/PhotoPicker.xcodeproj/xcshareddata/xcschemes/PhotoPicker.xcscheme +++ b/PhotoPicker.xcodeproj/xcshareddata/xcschemes/PhotoPicker.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/PhotoPicker/AlbumsViewController.swift b/PhotoPicker/AlbumsViewController.swift index 6e43239..a39ccef 100644 --- a/PhotoPicker/AlbumsViewController.swift +++ b/PhotoPicker/AlbumsViewController.swift @@ -41,11 +41,6 @@ class AlbumsViewController: UITableViewController { navigationController?.setToolbarHidden(true, animated: false) } - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } - // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { @@ -77,7 +72,7 @@ class AlbumsViewController: UITableViewController { //MARK: - response method extension AlbumsViewController { - func cancelButtonTapped(_ sender: UIBarButtonItem) { + @objc func cancelButtonTapped(_ sender: UIBarButtonItem) { photoPickerController.delegate?.photoPickerControllerDidCancel(photoPickerController) } } diff --git a/PhotoPicker/AssetCell.swift b/PhotoPicker/AssetCell.swift index 8f2064e..3628a9b 100644 --- a/PhotoPicker/AssetCell.swift +++ b/PhotoPicker/AssetCell.swift @@ -31,7 +31,7 @@ class AssetCell: UICollectionViewCell { checkHandler = nil } - func tapGestureHandler(_ recognizer: UIGestureRecognizer) { + @objc func tapGestureHandler(_ recognizer: UIGestureRecognizer) { guard let handler = checkHandler else { return } if handler(checked) { setChecked(!checked, animation: true) diff --git a/PhotoPicker/AssetsViewController.swift b/PhotoPicker/AssetsViewController.swift index b59993e..5d2d8b3 100644 --- a/PhotoPicker/AssetsViewController.swift +++ b/PhotoPicker/AssetsViewController.swift @@ -191,12 +191,12 @@ class AssetsViewController: UICollectionViewController { //MARK: - response method extension AssetsViewController { - func sendButtonTapped() { + @objc func sendButtonTapped() { guard selectedAssets.count > 0 else { return } photoPickerController.delegate?.photoPickerController(photoPickerController, didFinishPickingAssets: selectedAssets, needHighQualityImage: toolbarHighQualityButton.checked) } - func cancelButtonTapped(_ sender: UIBarButtonItem) { + @objc func cancelButtonTapped(_ sender: UIBarButtonItem) { photoPickerController.delegate?.photoPickerControllerDidCancel(photoPickerController) } diff --git a/PhotoPicker/Info.plist b/PhotoPicker/Info.plist index d3de8ee..8bce5c7 100644 --- a/PhotoPicker/Info.plist +++ b/PhotoPicker/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 1.4.0 CFBundleSignature ???? CFBundleVersion diff --git a/PhotoPicker/PhotoPicker.storyboard b/PhotoPicker/PhotoPicker.storyboard index e68c7b3..577db86 100644 --- a/PhotoPicker/PhotoPicker.storyboard +++ b/PhotoPicker/PhotoPicker.storyboard @@ -1,11 +1,11 @@ - + - + @@ -63,14 +63,14 @@ -