diff --git a/FMPhotoPicker/FMPhotoPicker.xcodeproj/project.pbxproj b/FMPhotoPicker/FMPhotoPicker.xcodeproj/project.pbxproj index 9dc767f..c2f36e7 100644 --- a/FMPhotoPicker/FMPhotoPicker.xcodeproj/project.pbxproj +++ b/FMPhotoPicker/FMPhotoPicker.xcodeproj/project.pbxproj @@ -437,16 +437,17 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Tribal Media House"; TargetAttributes = { CEE50D0820196DF9005AE708 = { CreatedOnToolsVersion = 9.2; - LastSwiftMigration = 0920; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; CEE50D1120196DF9005AE708 = { CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; @@ -457,6 +458,7 @@ hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = CEE50CFF20196DF9005AE708; productRefGroup = CEE50D0A20196DF9005AE708 /* Products */; @@ -581,6 +583,7 @@ 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -588,6 +591,7 @@ 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; @@ -641,6 +645,7 @@ 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -648,6 +653,7 @@ 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; @@ -698,7 +704,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -720,7 +726,7 @@ PRODUCT_BUNDLE_IDENTIFIER = jp.co.tribalmedia.FMPhotoPicker; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -734,7 +740,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.tribalmedia.FMPhotoPickerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -748,7 +754,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.tribalmedia.FMPhotoPickerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/FMPhotoPicker/FMPhotoPicker.xcodeproj/xcshareddata/xcschemes/FMPhotoPicker.xcscheme b/FMPhotoPicker/FMPhotoPicker.xcodeproj/xcshareddata/xcschemes/FMPhotoPicker.xcscheme index 37f31de..c1bc434 100644 --- a/FMPhotoPicker/FMPhotoPicker.xcodeproj/xcshareddata/xcschemes/FMPhotoPicker.xcscheme +++ b/FMPhotoPicker/FMPhotoPicker.xcodeproj/xcshareddata/xcschemes/FMPhotoPicker.xcscheme @@ -1,6 +1,6 @@ Int? { - return self.selectedPhotoIndexes.index(where: { $0 == index }) + return self.selectedPhotoIndexes.firstIndex(where: { $0 == index }) } public func numberOfSelectedPhoto() -> Int { @@ -70,7 +70,7 @@ class FMPhotosDataSource { } public func index(ofPhoto photo: FMPhotoAsset) -> Int? { - return self.photoAssets.index(where: { $0 === photo }) + return self.photoAssets.firstIndex(where: { $0 === photo }) } public func contains(photo: FMPhotoAsset) -> Bool { diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Picker/FMPhotoPickerBatchSelector.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Picker/FMPhotoPickerBatchSelector.swift index 6b027a7..3f7eb5c 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Picker/FMPhotoPickerBatchSelector.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Picker/FMPhotoPickerBatchSelector.swift @@ -185,7 +185,7 @@ class FMPhotoPickerBatchSelector: NSObject { var result = [PanSelection]() for index in fromIndex...toIndex { - let found = self.panSelections.index(where: { $0.indexPath.item == index }) + let found = self.panSelections.firstIndex(where: { $0.indexPath.item == index }) if let found = found { result.append(self.panSelections[found]) } @@ -198,7 +198,7 @@ class FMPhotoPickerBatchSelector: NSObject { */ private func removeFromPrevSection(panSelectionsTobeReset: [PanSelection]) { panSelectionsTobeReset.forEach { panSelection in - if let found = self.panSelections.index(where: { $0.indexPath == panSelection.indexPath }) { + if let found = self.panSelections.firstIndex(where: { $0.indexPath == panSelection.indexPath }) { self.panSelections.remove(at: found) } } diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift index 1db2017..8959942 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift @@ -433,10 +433,18 @@ public class FMImageEditorViewController: UIViewController { // MARK: - Logics private func contentFrameCrop() -> CGRect { + let frameWidth: CGFloat = view.bounds.width - 2 * kContentFrameSpacing + var frameHeight: CGFloat = view.bounds.height + frameHeight -= transparentViewHeightConstraint.constant + frameHeight -= bottomMenuContainer.frame.height + frameHeight -= subMenuContainer.frame.height + frameHeight -= unsafeAreaBottomViewHeightConstraint.constant + frameHeight -= 2 * kContentFrameSpacing + return CGRect(x: kContentFrameSpacing, y: kContentFrameSpacing + transparentViewHeightConstraint.constant, - width: view.bounds.width - 2 * kContentFrameSpacing, - height: view.bounds.height - transparentViewHeightConstraint.constant - bottomMenuContainer.frame.height - subMenuContainer.frame.height - unsafeAreaBottomViewHeightConstraint.constant - 2 * kContentFrameSpacing) + width: frameWidth, + height: frameHeight) } private func contentFrameFilter() -> CGRect { diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropMenuView.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropMenuView.swift index 5ffa5e3..ea6625c 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropMenuView.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropMenuView.swift @@ -165,7 +165,7 @@ extension FMCropMenuView: UICollectionViewDelegate { cell.setSelected() if let prevCropItem = prevCropItem, - let prevRow = cropItems.index(where: { $0.identifier() == prevCropItem.identifier() }) { + let prevRow = cropItems.firstIndex(where: { $0.identifier() == prevCropItem.identifier() }) { collectionView.reloadItems(at: [IndexPath(row: prevRow, section: 1)]) } } diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFiltersMenuView.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFiltersMenuView.swift index 2297f51..d531007 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFiltersMenuView.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFiltersMenuView.swift @@ -36,7 +36,7 @@ class FMFiltersMenuView: UIView { super.init(frame: .zero) - if let index = self.availableFilters.index(where: { return $0.filterName() == appliedFilter?.filterName() }) { + if let index = self.availableFilters.firstIndex(where: { return $0.filterName() == appliedFilter?.filterName() }) { self.selectedCellIndex = index }