diff --git a/.mention-bot b/.mention-bot deleted file mode 100644 index 08affd9c..00000000 --- a/.mention-bot +++ /dev/null @@ -1,3 +0,0 @@ -{ - "maxReviewers": 2 -} diff --git a/.slather.yml b/.slather.yml deleted file mode 100644 index 58191204..00000000 --- a/.slather.yml +++ /dev/null @@ -1,4 +0,0 @@ -ci_service: travis_ci -coverage_service: coveralls -xcodeproj: Tests/Tests.xcodeproj -source_directory: Source diff --git a/.swift-version b/.swift-version index f398a206..389f7740 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.0 \ No newline at end of file +4.0 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c2157df2..00000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -osx_image: xcode8 -language: objective-c - -script: -- xcodebuild clean build -project ImagePicker.xcodeproj -scheme "ImagePicker-iOS" -sdk iphonesimulator diff --git a/Demo/ImagePickerDemo/ImagePickerDemo.xcodeproj/project.pbxproj b/Demo/ImagePickerDemo/ImagePickerDemo.xcodeproj/project.pbxproj index 7e48de9c..b0925db2 100644 --- a/Demo/ImagePickerDemo/ImagePickerDemo.xcodeproj/project.pbxproj +++ b/Demo/ImagePickerDemo/ImagePickerDemo.xcodeproj/project.pbxproj @@ -10,7 +10,7 @@ 29D699DF1B70ABFC0021FA73 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29D699DE1B70ABFC0021FA73 /* AppDelegate.swift */; }; 29D699E61B70ABFC0021FA73 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 29D699E51B70ABFC0021FA73 /* Images.xcassets */; }; 29D699E91B70ABFC0021FA73 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29D699E71B70ABFC0021FA73 /* LaunchScreen.xib */; }; - 4221AE1F43A643A689082012 /* Pods_ImagePickerDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1148A4E4BFF9A0AAED07754 /* Pods_ImagePickerDemo.framework */; }; + A23836048FD18F274FB629F2 /* Pods_ImagePickerDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E0B31E77EFE064C4E63D017 /* Pods_ImagePickerDemo.framework */; }; D20AA8A51D5330100085FF5B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20AA8A41D5330100085FF5B /* ViewController.swift */; }; /* End PBXBuildFile section */ @@ -20,11 +20,11 @@ 29D699DE1B70ABFC0021FA73 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 29D699E51B70ABFC0021FA73 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 29D699E81B70ABFC0021FA73 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 6F9E1FF802198DC16F260795 /* Pods-ImagePickerDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImagePickerDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo.release.xcconfig"; sourceTree = ""; }; + 2A8853E2BE3B43C6DC7CF614 /* Pods-ImagePickerDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImagePickerDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo.debug.xcconfig"; sourceTree = ""; }; + 3E0B31E77EFE064C4E63D017 /* Pods_ImagePickerDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ImagePickerDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 733A7AD0105A657A80502E72 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C4392341AC7391C01AD9F350 /* Pods-ImagePickerDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImagePickerDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo.debug.xcconfig"; sourceTree = ""; }; + 7F1C1FC700491641CD7DB2C1 /* Pods-ImagePickerDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImagePickerDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo.release.xcconfig"; sourceTree = ""; }; D20AA8A41D5330100085FF5B /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - F1148A4E4BFF9A0AAED07754 /* Pods_ImagePickerDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ImagePickerDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -32,7 +32,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4221AE1F43A643A689082012 /* Pods_ImagePickerDemo.framework in Frameworks */, + A23836048FD18F274FB629F2 /* Pods_ImagePickerDemo.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -45,7 +45,7 @@ 29D699DB1B70ABFC0021FA73 /* ImagePickerDemo */, 29D699DA1B70ABFC0021FA73 /* Products */, DD112158CF9886DE925FED5E /* Frameworks */, - A067DFAD5749963FA2D2ADED /* Pods */, + 388F913CF71E1D89FDE2519A /* Pods */, ); indentWidth = 2; sourceTree = ""; @@ -79,11 +79,11 @@ name = "Supporting Files"; sourceTree = ""; }; - A067DFAD5749963FA2D2ADED /* Pods */ = { + 388F913CF71E1D89FDE2519A /* Pods */ = { isa = PBXGroup; children = ( - C4392341AC7391C01AD9F350 /* Pods-ImagePickerDemo.debug.xcconfig */, - 6F9E1FF802198DC16F260795 /* Pods-ImagePickerDemo.release.xcconfig */, + 2A8853E2BE3B43C6DC7CF614 /* Pods-ImagePickerDemo.debug.xcconfig */, + 7F1C1FC700491641CD7DB2C1 /* Pods-ImagePickerDemo.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -92,7 +92,7 @@ isa = PBXGroup; children = ( 733A7AD0105A657A80502E72 /* Pods.framework */, - F1148A4E4BFF9A0AAED07754 /* Pods_ImagePickerDemo.framework */, + 3E0B31E77EFE064C4E63D017 /* Pods_ImagePickerDemo.framework */, ); name = Frameworks; sourceTree = ""; @@ -104,12 +104,12 @@ isa = PBXNativeTarget; buildConfigurationList = 29D699F81B70ABFC0021FA73 /* Build configuration list for PBXNativeTarget "ImagePickerDemo" */; buildPhases = ( - CFC24DB54992EE46F3A63C6F /* [CP] Check Pods Manifest.lock */, + 31B4D2E55A81DB27B864B2A3 /* [CP] Check Pods Manifest.lock */, 29D699D51B70ABFC0021FA73 /* Sources */, 29D699D61B70ABFC0021FA73 /* Frameworks */, 29D699D71B70ABFC0021FA73 /* Resources */, - A0BD0958A43D0416D3FF9365 /* [CP] Embed Pods Frameworks */, - 6821C4AC157C46704C0307CA /* [CP] Copy Pods Resources */, + F3EF51BCE509121FBC00640E /* [CP] Embed Pods Frameworks */, + EEE9A1733584FC13190615E2 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -127,7 +127,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Ramon Gilabert Llop"; TargetAttributes = { 29D699D81B70ABFC0021FA73 = { @@ -167,49 +167,65 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 6821C4AC157C46704C0307CA /* [CP] Copy Pods Resources */ = { + 31B4D2E55A81DB27B864B2A3 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-ImagePickerDemo-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - A0BD0958A43D0416D3FF9365 /* [CP] Embed Pods Frameworks */ = { + EEE9A1733584FC13190615E2 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo-resources.sh\"\n"; showEnvVarsInLog = 0; }; - CFC24DB54992EE46F3A63C6F /* [CP] Check Pods Manifest.lock */ = { + F3EF51BCE509121FBC00640E /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Cache/Cache.framework", + "${BUILT_PRODUCTS_DIR}/Hue/Hue.framework", + "${BUILT_PRODUCTS_DIR}/ImagePicker/ImagePicker.framework", + "${BUILT_PRODUCTS_DIR}/Imaginary/Imaginary.framework", + "${BUILT_PRODUCTS_DIR}/Lightbox/Lightbox.framework", + "${BUILT_PRODUCTS_DIR}/SwiftHash/SwiftHash.framework", ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cache.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Hue.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ImagePicker.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Imaginary.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lightbox.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftHash.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ImagePickerDemo/Pods-ImagePickerDemo-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -246,14 +262,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; @@ -277,11 +299,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -294,14 +317,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; @@ -318,10 +347,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -329,7 +359,7 @@ }; 29D699F91B70ABFC0021FA73 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C4392341AC7391C01AD9F350 /* Pods-ImagePickerDemo.debug.xcconfig */; + baseConfigurationReference = 2A8853E2BE3B43C6DC7CF614 /* Pods-ImagePickerDemo.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -342,13 +372,12 @@ PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePickerDemo2; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; }; name = Debug; }; 29D699FA1B70ABFC0021FA73 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 6F9E1FF802198DC16F260795 /* Pods-ImagePickerDemo.release.xcconfig */; + baseConfigurationReference = 7F1C1FC700491641CD7DB2C1 /* Pods-ImagePickerDemo.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -361,7 +390,6 @@ PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePickerDemo2; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/Demo/ImagePickerDemo/ImagePickerDemo/ViewController.swift b/Demo/ImagePickerDemo/ImagePickerDemo/ViewController.swift index 2e64027c..a00c0f8e 100644 --- a/Demo/ImagePickerDemo/ImagePickerDemo/ViewController.swift +++ b/Demo/ImagePickerDemo/ImagePickerDemo/ViewController.swift @@ -35,15 +35,14 @@ class ViewController: UIViewController, ImagePickerDelegate { return button } - func buttonTouched(button: UIButton) { + @objc func buttonTouched(button: UIButton) { var config = Configuration() config.doneButtonTitle = "Finish" config.noImagesTitle = "Sorry! There are no images here!" config.recordLocation = false config.allowVideoSelection = true - let imagePicker = ImagePickerController() - imagePicker.configuration = config + let imagePicker = ImagePickerController(configuration: config) imagePicker.delegate = self present(imagePicker, animated: true, completion: nil) diff --git a/Demo/ImagePickerDemo/Podfile b/Demo/ImagePickerDemo/Podfile index ba698fe9..c6bd1155 100644 --- a/Demo/ImagePickerDemo/Podfile +++ b/Demo/ImagePickerDemo/Podfile @@ -1,11 +1,10 @@ -platform :ios, '8.2' +platform :ios, '9.2' use_frameworks! inhibit_all_warnings! target 'ImagePickerDemo' do pod 'ImagePicker', path: '../../' - pod 'Lightbox', git: 'https://github.com/hyperoslo/Lightbox.git' - pod 'Sugar', git: 'https://github.com/hyperoslo/Sugar.git' - pod 'Hue', git: 'https://github.com/hyperoslo/Hue.git' + pod 'Lightbox' + pod 'Hue' end diff --git a/Demo/ImagePickerDemo/Podfile.lock b/Demo/ImagePickerDemo/Podfile.lock index 5ac06f5b..35af9e2b 100644 --- a/Demo/ImagePickerDemo/Podfile.lock +++ b/Demo/ImagePickerDemo/Podfile.lock @@ -1,43 +1,32 @@ PODS: - - Hue (2.0.1) - - ImagePicker (2.1.1) - - Lightbox (1.0.0): - - Hue - - Sugar (3.1.2) + - Cache (4.0.2): + - SwiftHash (~> 2.0.0) + - Hue (3.0.0) + - ImagePicker (3.0.0) + - Imaginary (3.0.0): + - Cache (~> 4.0) + - Lightbox (2.0.0): + - Hue (~> 3.0) + - Imaginary (~> 3.0) + - SwiftHash (2.0.0) DEPENDENCIES: - - Hue (from `https://github.com/hyperoslo/Hue.git`) + - Hue - ImagePicker (from `../../`) - - Lightbox (from `https://github.com/hyperoslo/Lightbox.git`) - - Sugar (from `https://github.com/hyperoslo/Sugar.git`) + - Lightbox EXTERNAL SOURCES: - Hue: - :git: https://github.com/hyperoslo/Hue.git ImagePicker: :path: ../../ - Lightbox: - :git: https://github.com/hyperoslo/Lightbox.git - Sugar: - :git: https://github.com/hyperoslo/Sugar.git - -CHECKOUT OPTIONS: - Hue: - :commit: 979ba84244b5166b461bf31bbb6dba561d2c2a1e - :git: https://github.com/hyperoslo/Hue.git - Lightbox: - :commit: 48f307b00332e4c5dc9a785757d974224f0f7307 - :git: https://github.com/hyperoslo/Lightbox.git - Sugar: - :commit: 41e0f1e92bfd29b805fa74f87444975ca2976887 - :git: https://github.com/hyperoslo/Sugar.git SPEC CHECKSUMS: - Hue: ab7efb15270e0bc764f2f468aa6f3f2728d52f2b - ImagePicker: 4845cf22f8dd201ff5730474b619f017d374a3b8 - Lightbox: a7edccb98c1a84a4b089a44dbaf2b39a409fbfcb - Sugar: 41f2efa0244806f524ff2d77c951a6a43e81a0f3 + Cache: 363b6899cee63c82ccbd291e64a6c202abc17a88 + Hue: b8fe1e43eef13631331eebecb2198b68e2622f95 + ImagePicker: f8a3ce52e587b55f58aef2d83d894ed6f7820f51 + Imaginary: 2765d293d425cbed3b07fa11642554cbaebe913d + Lightbox: 83ec9f4aba4c79fc7bb9bcd263386df9969f09bb + SwiftHash: d2e09b13495447178cdfb8e46e54a5c46f15f5a9 -PODFILE CHECKSUM: 4211a335ad26e5b66e84b7da22d4a0fcf78fb3ca +PODFILE CHECKSUM: 702c1e0df019fe44ce740e86904dd384d55aefbe -COCOAPODS: 1.1.0.rc.3 +COCOAPODS: 1.3.1 diff --git a/ImagePicker.podspec b/ImagePicker.podspec index deef4505..4c97ee2a 100644 --- a/ImagePicker.podspec +++ b/ImagePicker.podspec @@ -1,16 +1,16 @@ Pod::Spec.new do |s| s.name = "ImagePicker" s.summary = "Reinventing the way ImagePicker works." - s.version = "2.1.1" + s.version = "3.0.0" s.homepage = "https://github.com/hyperoslo/ImagePicker" s.license = 'MIT' s.author = { "Hyper Interaktiv AS" => "ios@hyper.no" } s.source = { :git => "https://github.com/hyperoslo/ImagePicker.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/hyperoslo' - s.platform = :ios, '8.2' + s.platform = :ios, '9.0' s.requires_arc = true s.source_files = 'Source/**/*' s.resource_bundles = { 'ImagePicker' => ['Images/*.{png}'] } s.frameworks = 'AVFoundation' - s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.0' } + s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' } end diff --git a/ImagePicker.xcodeproj/project.pbxproj b/ImagePicker.xcodeproj/project.pbxproj index 0420dbe4..046f86d9 100644 --- a/ImagePicker.xcodeproj/project.pbxproj +++ b/ImagePicker.xcodeproj/project.pbxproj @@ -273,12 +273,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Hyper Interaktiv AS"; TargetAttributes = { D5DC598A1C201BE1003BD79B = { CreatedOnToolsVersion = 7.2; - DevelopmentTeam = QQJ8AA32HJ; + DevelopmentTeam = 9J5NKKT78R; LastSwiftMigration = 0800; }; D5DC59941C201BE1003BD79B = { @@ -397,14 +397,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; @@ -428,11 +434,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = YES; 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 = ""; @@ -447,14 +454,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; @@ -472,10 +485,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; 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"; @@ -488,7 +502,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = QQJ8AA32HJ; + DEVELOPMENT_TEAM = 9J5NKKT78R; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -499,7 +513,6 @@ PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePicker; PRODUCT_NAME = ImagePicker; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -508,7 +521,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = QQJ8AA32HJ; + DEVELOPMENT_TEAM = 9J5NKKT78R; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -519,7 +532,6 @@ PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePicker; PRODUCT_NAME = ImagePicker; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/ImagePicker.xcodeproj/xcshareddata/xcschemes/ImagePicker-iOS.xcscheme b/ImagePicker.xcodeproj/xcshareddata/xcschemes/ImagePicker-iOS.xcscheme index 376e6f8f..a74e2131 100644 --- a/ImagePicker.xcodeproj/xcshareddata/xcschemes/ImagePicker-iOS.xcscheme +++ b/ImagePicker.xcodeproj/xcshareddata/xcschemes/ImagePicker-iOS.xcscheme @@ -1,6 +1,6 @@ + **ImagePicker** is an all-in-one camera solution for your iOS app. It lets your users select images from the library and take pictures at the same time. As a developer you get notified of all the user interactions and get the beautiful UI for free, out of the box, it's just that simple. **ImagePicker** has been optimized to give a great user experience, it passes around referenced images instead of the image itself which makes it less memory consuming. This is what makes it smooth as butter. @@ -90,7 +90,7 @@ github "hyperoslo/ImagePicker" ## Author -[Hyper](http://hyper.no) made this with ❤️. If you’re using this library we probably want to [hire you](https://github.com/hyperoslo/iOS-playbook/blob/master/HYPER_RECIPES.md)! Send us an email at ios@hyper.no. +[Hyper](http://hyper.no) made this with ❤️ ## Contribute diff --git a/Source/BottomView/BottomContainerView.swift b/Source/BottomView/BottomContainerView.swift index 2d020680..63fca01b 100644 --- a/Source/BottomView/BottomContainerView.swift +++ b/Source/BottomView/BottomContainerView.swift @@ -92,7 +92,7 @@ open class BottomContainerView: UIView { // MARK: - Action methods - func doneButtonDidPress(_ button: UIButton) { + @objc func doneButtonDidPress(_ button: UIButton) { if button.currentTitle == configuration.cancelButtonTitle { delegate?.cancelButtonDidPress() } else { @@ -100,7 +100,7 @@ open class BottomContainerView: UIView { } } - func handleTapGestureRecognizer(_ recognizer: UITapGestureRecognizer) { + @objc func handleTapGestureRecognizer(_ recognizer: UITapGestureRecognizer) { delegate?.imageStackViewDidPress() } @@ -110,7 +110,7 @@ open class BottomContainerView: UIView { UIView.animate(withDuration: 0.3, animations: { imageView.transform = CGAffineTransform(scaleX: 1.05, y: 1.05) }, completion: { _ in - UIView.animate(withDuration: 0.2, animations: { _ in + UIView.animate(withDuration: 0.2, animations: { imageView.transform = CGAffineTransform.identity }) }) diff --git a/Source/BottomView/ButtonPicker.swift b/Source/BottomView/ButtonPicker.swift index 194ae833..f6aacfa9 100644 --- a/Source/BottomView/ButtonPicker.swift +++ b/Source/BottomView/ButtonPicker.swift @@ -85,20 +85,20 @@ class ButtonPicker: UIButton { // MARK: - Actions - func recalculatePhotosCount(_ notification: Notification) { + @objc func recalculatePhotosCount(_ notification: Notification) { guard let sender = notification.object as? ImageStack else { return } numberLabel.text = sender.assets.isEmpty ? "" : String(sender.assets.count) } - func pickerButtonDidPress(_ button: UIButton) { + @objc func pickerButtonDidPress(_ button: UIButton) { backgroundColor = UIColor.white numberLabel.textColor = UIColor.black numberLabel.sizeToFit() delegate?.buttonDidPress() } - func pickerButtonDidHighlight(_ button: UIButton) { + @objc func pickerButtonDidHighlight(_ button: UIButton) { numberLabel.textColor = UIColor.white - backgroundColor = UIColor(red:0.3, green:0.3, blue:0.3, alpha:1) + backgroundColor = UIColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1) } } diff --git a/Source/BottomView/StackView.swift b/Source/BottomView/StackView.swift index 71b7ed4e..9402c8ba 100644 --- a/Source/BottomView/StackView.swift +++ b/Source/BottomView/StackView.swift @@ -105,7 +105,7 @@ class ImageStackView: UIView { extension ImageStackView { - func imageDidPush(_ notification: Notification) { + @objc func imageDidPush(_ notification: Notification) { let emptyView = views.filter { $0.image == nil }.first if let emptyView = emptyView { @@ -118,14 +118,14 @@ extension ImageStackView { } } - func imageStackDidChangeContent(_ notification: Notification) { + @objc func imageStackDidChangeContent(_ notification: Notification) { if let sender = notification.object as? ImageStack { renderViews(sender.assets) activityView.stopAnimating() } } - func renderViews(_ assets: [PHAsset]) { + @objc func renderViews(_ assets: [PHAsset]) { if let firstView = views.first, assets.isEmpty { views.forEach { $0.image = nil diff --git a/Source/CameraView/CameraMan.swift b/Source/CameraView/CameraMan.swift index 5e9f6ccb..8714823f 100644 --- a/Source/CameraView/CameraMan.swift +++ b/Source/CameraView/CameraMan.swift @@ -33,10 +33,9 @@ class CameraMan { func setupDevices() { // Input AVCaptureDevice - .devices().flatMap { - return $0 as? AVCaptureDevice - }.filter { - return $0.hasMediaType(AVMediaTypeVideo) + .devices() + .filter { + return $0.hasMediaType(AVMediaType.video) }.forEach { switch $0.position { case .front: @@ -68,7 +67,7 @@ class CameraMan { // MARK: - Permission func checkPermission() { - let status = AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) + let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.video) switch status { case .authorized: @@ -81,7 +80,7 @@ class CameraMan { } func requestPermission() { - AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo) { granted in + AVCaptureDevice.requestAccess(for: AVMediaType.video) { granted in DispatchQueue.main.async { if granted { self.start() @@ -151,7 +150,7 @@ class CameraMan { } func takePhoto(_ previewLayer: AVCaptureVideoPreviewLayer, location: CLLocation?, completion: (() -> Void)? = nil) { - guard let connection = stillImageOutput?.connection(withMediaType: AVMediaTypeVideo) else { return } + guard let connection = stillImageOutput?.connection(with: AVMediaType.video) else { return } connection.videoOrientation = Helper.videoOrientation() @@ -177,14 +176,14 @@ class CameraMan { let request = PHAssetChangeRequest.creationRequestForAsset(from: image) request.creationDate = Date() request.location = location - }, completionHandler: { _ in + }, completionHandler: { (_, _) in DispatchQueue.main.async { completion?() } }) } - func flash(_ mode: AVCaptureFlashMode) { + func flash(_ mode: AVCaptureDevice.FlashMode) { guard let device = currentInput?.device, device.isFlashModeSupported(mode) else { return } queue.async { @@ -195,7 +194,7 @@ class CameraMan { } func focus(_ point: CGPoint) { - guard let device = currentInput?.device, device.isFocusModeSupported(AVCaptureFocusMode.locked) else { return } + guard let device = currentInput?.device, device.isFocusModeSupported(AVCaptureDevice.FocusMode.locked) else { return } queue.async { self.lock { @@ -234,8 +233,8 @@ class CameraMan { func configurePreset(_ input: AVCaptureDeviceInput) { for asset in preferredPresets() { - if input.device.supportsAVCaptureSessionPreset(asset) && self.session.canSetSessionPreset(asset) { - self.session.sessionPreset = asset + if input.device.supportsSessionPreset(AVCaptureSession.Preset(rawValue: asset)) && self.session.canSetSessionPreset(AVCaptureSession.Preset(rawValue: asset)) { + self.session.sessionPreset = AVCaptureSession.Preset(rawValue: asset) return } } @@ -243,9 +242,9 @@ class CameraMan { func preferredPresets() -> [String] { return [ - AVCaptureSessionPresetHigh, - AVCaptureSessionPresetMedium, - AVCaptureSessionPresetLow + AVCaptureSession.Preset.high.rawValue, + AVCaptureSession.Preset.high.rawValue, + AVCaptureSession.Preset.low.rawValue ] } } diff --git a/Source/CameraView/CameraView.swift b/Source/CameraView/CameraView.swift index 956fa715..96eaa711 100644 --- a/Source/CameraView/CameraView.swift +++ b/Source/CameraView/CameraView.swift @@ -59,8 +59,8 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate let button = UIButton(type: .system) let title = NSAttributedString(string: self.configuration.settingsTitle, attributes: [ - NSFontAttributeName: self.configuration.settingsFont, - NSForegroundColorAttributeName: self.configuration.settingsColor + NSAttributedStringKey.font: self.configuration.settingsFont, + NSAttributedStringKey.foregroundColor: self.configuration.settingsColor ]) button.setAttributedTitle(title, for: UIControlState()) @@ -142,7 +142,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - previewLayer?.connection.videoOrientation = .portrait + previewLayer?.connection?.videoOrientation = .portrait locationManager?.startUpdatingLocation() } @@ -152,11 +152,11 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate } func setupPreviewLayer() { - guard let layer = AVCaptureVideoPreviewLayer(session: cameraMan.session) else { return } + let layer = AVCaptureVideoPreviewLayer(session: cameraMan.session) layer.backgroundColor = configuration.mainColor.cgColor layer.autoreverses = true - layer.videoGravity = AVLayerVideoGravityResizeAspectFill + layer.videoGravity = AVLayerVideoGravity.resizeAspectFill view.layer.insertSublayer(layer, at: 0) layer.frame = view.layer.frame @@ -185,7 +185,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate // MARK: - Actions - func settingsButtonDidTap() { + @objc func settingsButtonDidTap() { DispatchQueue.main.async { if let settingsURL = URL(string: UIApplicationOpenSettingsURLString) { UIApplication.shared.openURL(settingsURL) @@ -196,7 +196,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate // MARK: - Camera actions func rotateCamera() { - UIView.animate(withDuration: 0.3, animations: { _ in + UIView.animate(withDuration: 0.3, animations: { self.containerView.alpha = 1 }, completion: { _ in self.cameraMan.switchCamera { @@ -208,7 +208,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate } func flashCamera(_ title: String) { - let mapping: [String: AVCaptureFlashMode] = [ + let mapping: [String: AVCaptureDevice.FlashMode] = [ "ON": .on, "OFF": .off ] @@ -235,7 +235,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate // MARK: - Timer methods - func timerDidFire() { + @objc func timerDidFire() { UIView.animate(withDuration: 0.3, animations: { [unowned self] in self.focusImageView.alpha = 0 }, completion: { _ in @@ -247,12 +247,12 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate func focusTo(_ point: CGPoint) { let convertedPoint = CGPoint(x: point.x / UIScreen.main.bounds.width, - y:point.y / UIScreen.main.bounds.height) + y: point.y / UIScreen.main.bounds.height) cameraMan.focus(convertedPoint) focusImageView.center = point - UIView.animate(withDuration: 0.5, animations: { _ in + UIView.animate(withDuration: 0.5, animations: { self.focusImageView.alpha = 1 self.focusImageView.transform = CGAffineTransform(scaleX: 0.6, y: 0.6) }, completion: { _ in @@ -273,7 +273,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate // MARK: - Tap - func tapGestureRecognizerHandler(_ gesture: UITapGestureRecognizer) { + @objc func tapGestureRecognizerHandler(_ gesture: UITapGestureRecognizer) { let touch = gesture.location(in: view) focusImageView.transform = CGAffineTransform.identity @@ -283,7 +283,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate // MARK: - Pinch - func pinchGestureRecognizerHandler(_ gesture: UIPinchGestureRecognizer) { + @objc func pinchGestureRecognizerHandler(_ gesture: UIPinchGestureRecognizer) { switch gesture.state { case .began: fallthrough diff --git a/Source/Configuration.swift b/Source/Configuration.swift index e00df0b9..af70a4d0 100644 --- a/Source/Configuration.swift +++ b/Source/Configuration.swift @@ -15,12 +15,12 @@ public struct Configuration { // MARK: Fonts - public var numberLabelFont = UIFont.systemFont(ofSize: 19, weight: UIFontWeightBold) - public var doneButton = UIFont.systemFont(ofSize: 19, weight: UIFontWeightMedium) - public var flashButton = UIFont.systemFont(ofSize: 12, weight: UIFontWeightMedium) - public var noImagesFont = UIFont.systemFont(ofSize: 18, weight: UIFontWeightMedium) - public var noCameraFont = UIFont.systemFont(ofSize: 18, weight: UIFontWeightMedium) - public var settingsFont = UIFont.systemFont(ofSize: 16, weight: UIFontWeightMedium) + public var numberLabelFont = UIFont.systemFont(ofSize: 19, weight: UIFont.Weight.bold) + public var doneButton = UIFont.systemFont(ofSize: 19, weight: UIFont.Weight.medium) + public var flashButton = UIFont.systemFont(ofSize: 12, weight: UIFont.Weight.medium) + public var noImagesFont = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium) + public var noCameraFont = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium) + public var settingsFont = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.medium) // MARK: Titles diff --git a/Source/ImageGallery/ImageGalleryLayout.swift b/Source/ImageGallery/ImageGalleryLayout.swift index a5b8f7c6..fb8999b4 100644 --- a/Source/ImageGallery/ImageGalleryLayout.swift +++ b/Source/ImageGallery/ImageGalleryLayout.swift @@ -20,6 +20,7 @@ class ImageGalleryLayout: UICollectionViewFlowLayout { var newAttributes = [UICollectionViewLayoutAttributes]() for attribute in attributes { + // swiftlint:disable force_cast let n = attribute.copy() as! UICollectionViewLayoutAttributes n.transform = configuration.rotationTransform newAttributes.append(n) diff --git a/Source/ImageGallery/ImageGalleryView.swift b/Source/ImageGallery/ImageGalleryView.swift index 03d036da..49566a8b 100644 --- a/Source/ImageGallery/ImageGalleryView.swift +++ b/Source/ImageGallery/ImageGalleryView.swift @@ -170,7 +170,7 @@ open class ImageGalleryView: UIView { // MARK: - Pan gesture recognizer - func handlePanGestureRecognizer(_ gesture: UIPanGestureRecognizer) { + @objc func handlePanGestureRecognizer(_ gesture: UIPanGestureRecognizer) { guard let superview = superview else { return } let translation = gesture.translation(in: superview) @@ -244,7 +244,7 @@ extension ImageGalleryView: UICollectionViewDelegate { } else if self.imageLimit == 0 || self.imageLimit > self.selectedStack.assets.count { cell.selectedImageView.image = AssetManager.getImage("selectedImageGallery") cell.selectedImageView.transform = CGAffineTransform(scaleX: 0, y: 0) - UIView.animate(withDuration: 0.2, animations: { _ in + UIView.animate(withDuration: 0.2, animations: { cell.selectedImageView.transform = CGAffineTransform.identity }) self.selectedStack.pushAsset(asset) diff --git a/Source/ImagePickerController.swift b/Source/ImagePickerController.swift index 91ea8d77..a317d809 100644 --- a/Source/ImagePickerController.swift +++ b/Source/ImagePickerController.swift @@ -11,7 +11,7 @@ import Photos open class ImagePickerController: UIViewController { - open var configuration = Configuration() + let configuration: Configuration struct GestureConstants { static let maximumHeight: CGFloat = 200 @@ -91,19 +91,13 @@ open class ImagePickerController: UIViewController { // MARK: - Initialization - public init(configuration: Configuration? = nil) { - if let configuration = configuration { - self.configuration = configuration - } + public required init(configuration: Configuration = Configuration()) { + self.configuration = configuration super.init(nibName: nil, bundle: nil) } - public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - } - - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) + public required init?(coder aDecoder: NSCoder) { + fatalError() } // MARK: - View lifecycle @@ -254,13 +248,13 @@ open class ImagePickerController: UIViewController { object: nil) } - func didReloadAssets(_ notification: Notification) { + @objc func didReloadAssets(_ notification: Notification) { adjustButtonTitle(notification) galleryView.collectionView.reloadData() galleryView.collectionView.setContentOffset(CGPoint.zero, animated: false) } - func volumeChanged(_ notification: Notification) { + @objc func volumeChanged(_ notification: Notification) { guard let slider = volumeView.subviews.filter({ $0 is UISlider }).first as? UISlider, let userInfo = (notification as NSNotification).userInfo, let changeReason = userInfo["AVSystemController_AudioVolumeChangeReasonNotificationParameter"] as? String, changeReason == "ExplicitVolumeChange" else { return } @@ -269,7 +263,7 @@ open class ImagePickerController: UIViewController { takePicture() } - func adjustButtonTitle(_ notification: Notification) { + @objc func adjustButtonTitle(_ notification: Notification) { guard let sender = notification.object as? ImageStack else { return } let title = !sender.assets.isEmpty ? @@ -313,7 +307,7 @@ open class ImagePickerController: UIViewController { self.galleryView.collectionView.transform = CGAffineTransform(scaleX: scale, y: scale) let value = self.view.frame.width * (scale - 1) / scale - self.galleryView.collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: value) + self.galleryView.collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: value) }) } @@ -371,7 +365,6 @@ extension ImagePickerController: BottomContainerViewDelegate { } func cancelButtonDidPress() { - dismiss(animated: true, completion: nil) delegate?.cancelButtonDidPress(self) } @@ -428,7 +421,7 @@ extension ImagePickerController: CameraViewDelegate { return .portrait } - public func handleRotation(_ note: Notification?) { + @objc public func handleRotation(_ note: Notification?) { applyOrientationTransforms() } @@ -480,7 +473,7 @@ extension ImagePickerController: ImageGalleryPanGestureDelegate { if let contentOffset = initialContentOffset { numberOfCells = Int(contentOffset.x / collectionSize.width) } } - func panGestureRecognizerHandler(_ gesture: UIPanGestureRecognizer) { + @objc func panGestureRecognizerHandler(_ gesture: UIPanGestureRecognizer) { let translation = gesture.translation(in: view) let velocity = gesture.velocity(in: view) @@ -509,7 +502,7 @@ extension ImagePickerController: ImageGalleryPanGestureDelegate { galleryView.frame.size.height = initialFrame.height - translation.y let value = view.frame.width * (scale - 1) / scale - galleryView.collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: value) + galleryView.collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: value) } else { galleryView.frame.origin.y = initialFrame.origin.y + translation.y galleryView.frame.size.height = initialFrame.height - translation.y diff --git a/Source/TopView/TopView.swift b/Source/TopView/TopView.swift index 7e9356a5..3a2454c4 100644 --- a/Source/TopView/TopView.swift +++ b/Source/TopView/TopView.swift @@ -86,7 +86,7 @@ open class TopView: UIView { // MARK: - Action methods - func flashButtonDidPress(_ button: UIButton) { + @objc func flashButtonDidPress(_ button: UIButton) { currentFlashIndex += 1 currentFlashIndex = currentFlashIndex % flashButtonTitles.count @@ -107,7 +107,7 @@ open class TopView: UIView { delegate?.flashButtonDidPress(newTitle) } - func rotateCameraButtonDidPress(_ button: UIButton) { + @objc func rotateCameraButtonDidPress(_ button: UIButton) { delegate?.rotateDeviceDidPress() } }