diff --git a/.swift-version b/.swift-version index 5186d07..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +4.2 diff --git a/NohanaImagePicker.xcodeproj/project.pbxproj b/NohanaImagePicker.xcodeproj/project.pbxproj index 044f34b..315663a 100644 --- a/NohanaImagePicker.xcodeproj/project.pbxproj +++ b/NohanaImagePicker.xcodeproj/project.pbxproj @@ -314,7 +314,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = nohana; TargetAttributes = { F208E5501CD7370B00FFC9F6 = { @@ -498,12 +498,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -556,12 +558,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -613,7 +617,7 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -634,7 +638,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/NohanaImagePicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/NohanaImagePicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/NohanaImagePicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/NohanaImagePicker.xcodeproj/xcshareddata/xcschemes/NohanaImagePicker.xcscheme b/NohanaImagePicker.xcodeproj/xcshareddata/xcschemes/NohanaImagePicker.xcscheme index e91e1ba..ecf32c3 100644 --- a/NohanaImagePicker.xcodeproj/xcshareddata/xcschemes/NohanaImagePicker.xcscheme +++ b/NohanaImagePicker.xcodeproj/xcshareddata/xcschemes/NohanaImagePicker.xcscheme @@ -1,6 +1,6 @@ UIViewControllerAnimatedTransitioning? { + func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { switch operation { case .push where fromVC is AssetListViewController: diff --git a/NohanaImagePicker/AssetCell.swift b/NohanaImagePicker/AssetCell.swift index 726747b..ca1a299 100644 --- a/NohanaImagePicker/AssetCell.swift +++ b/NohanaImagePicker/AssetCell.swift @@ -30,7 +30,7 @@ class AssetCell: UICollectionViewCell { let droppedImage: UIImage? = nohanaImagePickerController.config.image.droppedSmall ?? UIImage(named: "btn_select_m", in: nohanaImagePickerController.assetBundle, compatibleWith: nil) let pickedImage: UIImage? = nohanaImagePickerController.config.image.pickedSmall ?? UIImage(named: "btn_selected_m", in: nohanaImagePickerController.assetBundle, compatibleWith: nil) - pickButton.setImage(droppedImage, for: UIControlState()) + pickButton.setImage(droppedImage, for: UIControl.State()) pickButton.setImage(pickedImage, for: .selected) } } diff --git a/NohanaImagePicker/AssetDetailListViewController.swift b/NohanaImagePicker/AssetDetailListViewController.swift index b28769e..06cd7e3 100644 --- a/NohanaImagePicker/AssetDetailListViewController.swift +++ b/NohanaImagePicker/AssetDetailListViewController.swift @@ -38,7 +38,7 @@ class AssetDetailListViewController: AssetListViewController { let droppedImage: UIImage? = nohanaImagePickerController.config.image.droppedLarge ?? UIImage(named: "btn_select_l", in: nohanaImagePickerController.assetBundle, compatibleWith: nil) let pickedImage: UIImage? = nohanaImagePickerController.config.image.pickedLarge ?? UIImage(named: "btn_selected_l", in: nohanaImagePickerController.assetBundle, compatibleWith: nil) - pickButton.setImage(droppedImage, for: UIControlState()) + pickButton.setImage(droppedImage, for: UIControl.State()) pickButton.setImage(pickedImage, for: .selected) } } @@ -76,7 +76,7 @@ class AssetDetailListViewController: AssetListViewController { } DispatchQueue.main.async { let toIndexPath = IndexPath(item: indexPath.item, section: 0) - self.collectionView?.scrollToItem(at: toIndexPath, at: UICollectionViewScrollPosition.centeredHorizontally, animated: false) + self.collectionView?.scrollToItem(at: toIndexPath, at: UICollectionView.ScrollPosition.centeredHorizontally, animated: false) } } diff --git a/NohanaImagePicker/AssetListViewController.swift b/NohanaImagePicker/AssetListViewController.swift index 8fe2e1d..8b71c3a 100644 --- a/NohanaImagePicker/AssetListViewController.swift +++ b/NohanaImagePicker/AssetListViewController.swift @@ -35,7 +35,7 @@ class AssetListViewController: UICollectionViewController, UICollectionViewDeleg return CGSize.zero } var numberOfColumns = nohanaImagePickerController.numberOfColumnsInLandscape - if UIInterfaceOrientationIsPortrait(UIApplication.shared.statusBarOrientation) { + if UIApplication.shared.statusBarOrientation.isPortrait { numberOfColumns = nohanaImagePickerController.numberOfColumnsInPortrait } let cellMargin: CGFloat = 2 diff --git a/NohanaImagePicker/ContractingAnimationController.swift b/NohanaImagePicker/ContractingAnimationController.swift index b807909..77b30a1 100644 --- a/NohanaImagePicker/ContractingAnimationController.swift +++ b/NohanaImagePicker/ContractingAnimationController.swift @@ -77,7 +77,7 @@ class ContractingAnimationController: NSObject, UIViewControllerAnimatedTransiti UIView.animate( withDuration: transitionDuration(using: transitionContext), delay: 0, - options: UIViewAnimationOptions(), + options: UIView.AnimationOptions(), animations: { toVC.view.alpha = 1 contractingImageView.frame = Size.contractingAnimationToCellRect(toVC, toCell: toCell) diff --git a/NohanaImagePicker/MomentViewController.swift b/NohanaImagePicker/MomentViewController.swift index dd807e7..ff5fa6d 100644 --- a/NohanaImagePicker/MomentViewController.swift +++ b/NohanaImagePicker/MomentViewController.swift @@ -99,7 +99,7 @@ class MomentViewController: AssetListViewController, ActivityIndicatable { override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { switch kind { - case UICollectionElementKindSectionHeader: + case UICollectionView.elementKindSectionHeader: let album = momentAlbumList[indexPath.section] guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "MomentHeader", for: indexPath) as? MomentSectionHeaderView else { fatalError("failed to create MomentHeader") @@ -125,7 +125,7 @@ class MomentViewController: AssetListViewController, ActivityIndicatable { var isLoading = true func setUpActivityIndicator() { - activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + activityIndicator = UIActivityIndicatorView(style: .gray) let screenRect = Size.screenRectWithoutAppBar(self) activityIndicator?.center = CGPoint(x: screenRect.size.width / 2, y: screenRect.size.height / 2) activityIndicator?.startAnimating() diff --git a/NohanaImagePicker/NohanaImagePickerController.swift b/NohanaImagePicker/NohanaImagePickerController.swift index a1fce79..ffea723 100644 --- a/NohanaImagePicker/NohanaImagePickerController.swift +++ b/NohanaImagePicker/NohanaImagePickerController.swift @@ -106,9 +106,9 @@ open class NohanaImagePickerController: UIViewController { guard let navigationController = storyboard.instantiateViewController(withIdentifier: viewControllerId) as? UINavigationController else { fatalError("navigationController init failed.") } - addChildViewController(navigationController) + addChild(navigationController) view.addSubview(navigationController.view) - navigationController.didMove(toParentViewController: self) + navigationController.didMove(toParent: self) // setup albumListViewController guard let albumListViewController = navigationController.topViewController as? AlbumListViewController else { diff --git a/NohanaImagePicker/PhotoKitAssetList.swift b/NohanaImagePicker/PhotoKitAssetList.swift index 7c185f9..d66f59b 100644 --- a/NohanaImagePicker/PhotoKitAssetList.swift +++ b/NohanaImagePicker/PhotoKitAssetList.swift @@ -19,7 +19,7 @@ import Photos open class PhotoKitAssetList: ItemList { fileprivate let mediaType: MediaType - open let assetList: PHAssetCollection + public let assetList: PHAssetCollection fileprivate var fetchResult: PHFetchResult! init(album: PHAssetCollection, mediaType: MediaType) {