├── .gitignore ├── IAImagePickerExample.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── IAImagePickerExample ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── album.imageset │ │ ├── Contents.json │ │ ├── album.png │ │ └── album@2x.png │ ├── camera.imageset │ │ ├── Contents.json │ │ ├── camera.png │ │ └── camera@2x.png │ ├── camera1.imageset │ │ ├── Contents.json │ │ ├── camera1.png │ │ └── camera1@2x.png │ ├── camera2.imageset │ │ ├── Contents.json │ │ ├── camera2.png │ │ └── camera2@2x.png │ ├── camera3.imageset │ │ ├── Contents.json │ │ ├── camera3.png │ │ └── camera3@2x.png │ ├── flashOFF.imageset │ │ ├── Contents.json │ │ ├── flashOFF.png │ │ └── flashOFF@2x.png │ ├── flashON.imageset │ │ ├── Contents.json │ │ ├── flashON.png │ │ └── flashON@2x.png │ ├── image (1).imageset │ │ ├── Contents.json │ │ └── image (1).png │ ├── multiply.imageset │ │ ├── Contents.json │ │ ├── multiply.png │ │ └── multiply@2x.png │ └── picture.imageset │ │ ├── Contents.json │ │ ├── image.png │ │ └── picture-1.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── IAImagePicker.swift ├── IAImagePickerViewController.swift ├── Info.plist └── ViewController.swift ├── IAImagePickerExampleTests ├── IAImagePickerExampleTests.swift └── Info.plist ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /IAImagePickerExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 561805251EAA132F004B5DE8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561805241EAA132F004B5DE8 /* AppDelegate.swift */; }; 11 | 561805271EAA132F004B5DE8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561805261EAA132F004B5DE8 /* ViewController.swift */; }; 12 | 5618052A1EAA132F004B5DE8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 561805281EAA132F004B5DE8 /* Main.storyboard */; }; 13 | 5618052C1EAA132F004B5DE8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5618052B1EAA132F004B5DE8 /* Assets.xcassets */; }; 14 | 5618052F1EAA132F004B5DE8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5618052D1EAA132F004B5DE8 /* LaunchScreen.storyboard */; }; 15 | 5618053A1EAA132F004B5DE8 /* IAImagePickerExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561805391EAA132F004B5DE8 /* IAImagePickerExampleTests.swift */; }; 16 | 561805461EAA13A5004B5DE8 /* IAImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561805451EAA13A5004B5DE8 /* IAImagePicker.swift */; }; 17 | 56D091AC1EB09D0E00A5E405 /* IAImagePickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D091AB1EB09D0E00A5E405 /* IAImagePickerViewController.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 561805361EAA132F004B5DE8 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 561805191EAA132E004B5DE8 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 561805201EAA132F004B5DE8; 26 | remoteInfo = IAImagePickerExample; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 561805211EAA132F004B5DE8 /* IAImagePickerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IAImagePickerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 561805241EAA132F004B5DE8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 561805261EAA132F004B5DE8 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | 561805291EAA132F004B5DE8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 5618052B1EAA132F004B5DE8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 36 | 5618052E1EAA132F004B5DE8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 37 | 561805301EAA132F004B5DE8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | 561805351EAA132F004B5DE8 /* IAImagePickerExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IAImagePickerExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 561805391EAA132F004B5DE8 /* IAImagePickerExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IAImagePickerExampleTests.swift; sourceTree = ""; }; 40 | 5618053B1EAA132F004B5DE8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 561805451EAA13A5004B5DE8 /* IAImagePicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IAImagePicker.swift; sourceTree = ""; }; 42 | 56D091AB1EB09D0E00A5E405 /* IAImagePickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IAImagePickerViewController.swift; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 5618051E1EAA132F004B5DE8 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | 561805321EAA132F004B5DE8 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 561805181EAA132E004B5DE8 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 561805231EAA132F004B5DE8 /* IAImagePickerExample */, 67 | 561805381EAA132F004B5DE8 /* IAImagePickerExampleTests */, 68 | 561805221EAA132F004B5DE8 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 561805221EAA132F004B5DE8 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 561805211EAA132F004B5DE8 /* IAImagePickerExample.app */, 76 | 561805351EAA132F004B5DE8 /* IAImagePickerExampleTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 561805231EAA132F004B5DE8 /* IAImagePickerExample */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 561805441EAA136C004B5DE8 /* IAImagePicker */, 85 | 561805241EAA132F004B5DE8 /* AppDelegate.swift */, 86 | 561805261EAA132F004B5DE8 /* ViewController.swift */, 87 | 56D091AB1EB09D0E00A5E405 /* IAImagePickerViewController.swift */, 88 | 561805281EAA132F004B5DE8 /* Main.storyboard */, 89 | 5618052B1EAA132F004B5DE8 /* Assets.xcassets */, 90 | 5618052D1EAA132F004B5DE8 /* LaunchScreen.storyboard */, 91 | 561805301EAA132F004B5DE8 /* Info.plist */, 92 | ); 93 | path = IAImagePickerExample; 94 | sourceTree = ""; 95 | }; 96 | 561805381EAA132F004B5DE8 /* IAImagePickerExampleTests */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 561805391EAA132F004B5DE8 /* IAImagePickerExampleTests.swift */, 100 | 5618053B1EAA132F004B5DE8 /* Info.plist */, 101 | ); 102 | path = IAImagePickerExampleTests; 103 | sourceTree = ""; 104 | }; 105 | 561805441EAA136C004B5DE8 /* IAImagePicker */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 561805451EAA13A5004B5DE8 /* IAImagePicker.swift */, 109 | ); 110 | name = IAImagePicker; 111 | sourceTree = ""; 112 | }; 113 | /* End PBXGroup section */ 114 | 115 | /* Begin PBXNativeTarget section */ 116 | 561805201EAA132F004B5DE8 /* IAImagePickerExample */ = { 117 | isa = PBXNativeTarget; 118 | buildConfigurationList = 5618053E1EAA132F004B5DE8 /* Build configuration list for PBXNativeTarget "IAImagePickerExample" */; 119 | buildPhases = ( 120 | 5618051D1EAA132F004B5DE8 /* Sources */, 121 | 5618051E1EAA132F004B5DE8 /* Frameworks */, 122 | 5618051F1EAA132F004B5DE8 /* Resources */, 123 | ); 124 | buildRules = ( 125 | ); 126 | dependencies = ( 127 | ); 128 | name = IAImagePickerExample; 129 | productName = IAImagePickerExample; 130 | productReference = 561805211EAA132F004B5DE8 /* IAImagePickerExample.app */; 131 | productType = "com.apple.product-type.application"; 132 | }; 133 | 561805341EAA132F004B5DE8 /* IAImagePickerExampleTests */ = { 134 | isa = PBXNativeTarget; 135 | buildConfigurationList = 561805411EAA132F004B5DE8 /* Build configuration list for PBXNativeTarget "IAImagePickerExampleTests" */; 136 | buildPhases = ( 137 | 561805311EAA132F004B5DE8 /* Sources */, 138 | 561805321EAA132F004B5DE8 /* Frameworks */, 139 | 561805331EAA132F004B5DE8 /* Resources */, 140 | ); 141 | buildRules = ( 142 | ); 143 | dependencies = ( 144 | 561805371EAA132F004B5DE8 /* PBXTargetDependency */, 145 | ); 146 | name = IAImagePickerExampleTests; 147 | productName = IAImagePickerExampleTests; 148 | productReference = 561805351EAA132F004B5DE8 /* IAImagePickerExampleTests.xctest */; 149 | productType = "com.apple.product-type.bundle.unit-test"; 150 | }; 151 | /* End PBXNativeTarget section */ 152 | 153 | /* Begin PBXProject section */ 154 | 561805191EAA132E004B5DE8 /* Project object */ = { 155 | isa = PBXProject; 156 | attributes = { 157 | LastSwiftUpdateCheck = 0830; 158 | LastUpgradeCheck = 0830; 159 | ORGANIZATIONNAME = Innotical; 160 | TargetAttributes = { 161 | 561805201EAA132F004B5DE8 = { 162 | CreatedOnToolsVersion = 8.3; 163 | DevelopmentTeam = 4RCKDZVQ59; 164 | ProvisioningStyle = Automatic; 165 | }; 166 | 561805341EAA132F004B5DE8 = { 167 | CreatedOnToolsVersion = 8.3; 168 | DevelopmentTeam = 4RCKDZVQ59; 169 | ProvisioningStyle = Automatic; 170 | TestTargetID = 561805201EAA132F004B5DE8; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 5618051C1EAA132E004B5DE8 /* Build configuration list for PBXProject "IAImagePickerExample" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 561805181EAA132E004B5DE8; 183 | productRefGroup = 561805221EAA132F004B5DE8 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 561805201EAA132F004B5DE8 /* IAImagePickerExample */, 188 | 561805341EAA132F004B5DE8 /* IAImagePickerExampleTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | 5618051F1EAA132F004B5DE8 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 5618052F1EAA132F004B5DE8 /* LaunchScreen.storyboard in Resources */, 199 | 5618052C1EAA132F004B5DE8 /* Assets.xcassets in Resources */, 200 | 5618052A1EAA132F004B5DE8 /* Main.storyboard in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | 561805331EAA132F004B5DE8 /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 5618051D1EAA132F004B5DE8 /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 561805271EAA132F004B5DE8 /* ViewController.swift in Sources */, 219 | 561805251EAA132F004B5DE8 /* AppDelegate.swift in Sources */, 220 | 56D091AC1EB09D0E00A5E405 /* IAImagePickerViewController.swift in Sources */, 221 | 561805461EAA13A5004B5DE8 /* IAImagePicker.swift in Sources */, 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | }; 225 | 561805311EAA132F004B5DE8 /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 5618053A1EAA132F004B5DE8 /* IAImagePickerExampleTests.swift in Sources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXSourcesBuildPhase section */ 234 | 235 | /* Begin PBXTargetDependency section */ 236 | 561805371EAA132F004B5DE8 /* PBXTargetDependency */ = { 237 | isa = PBXTargetDependency; 238 | target = 561805201EAA132F004B5DE8 /* IAImagePickerExample */; 239 | targetProxy = 561805361EAA132F004B5DE8 /* PBXContainerItemProxy */; 240 | }; 241 | /* End PBXTargetDependency section */ 242 | 243 | /* Begin PBXVariantGroup section */ 244 | 561805281EAA132F004B5DE8 /* Main.storyboard */ = { 245 | isa = PBXVariantGroup; 246 | children = ( 247 | 561805291EAA132F004B5DE8 /* Base */, 248 | ); 249 | name = Main.storyboard; 250 | sourceTree = ""; 251 | }; 252 | 5618052D1EAA132F004B5DE8 /* LaunchScreen.storyboard */ = { 253 | isa = PBXVariantGroup; 254 | children = ( 255 | 5618052E1EAA132F004B5DE8 /* Base */, 256 | ); 257 | name = LaunchScreen.storyboard; 258 | sourceTree = ""; 259 | }; 260 | /* End PBXVariantGroup section */ 261 | 262 | /* Begin XCBuildConfiguration section */ 263 | 5618053C1EAA132F004B5DE8 /* Debug */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | ALWAYS_SEARCH_USER_PATHS = NO; 267 | CLANG_ANALYZER_NONNULL = YES; 268 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 269 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 270 | CLANG_CXX_LIBRARY = "libc++"; 271 | CLANG_ENABLE_MODULES = YES; 272 | CLANG_ENABLE_OBJC_ARC = YES; 273 | CLANG_WARN_BOOL_CONVERSION = YES; 274 | CLANG_WARN_CONSTANT_CONVERSION = YES; 275 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 276 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 277 | CLANG_WARN_EMPTY_BODY = YES; 278 | CLANG_WARN_ENUM_CONVERSION = YES; 279 | CLANG_WARN_INFINITE_RECURSION = YES; 280 | CLANG_WARN_INT_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = dwarf; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | ENABLE_TESTABILITY = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_DYNAMIC_NO_PIC = NO; 292 | GCC_NO_COMMON_BLOCKS = YES; 293 | GCC_OPTIMIZATION_LEVEL = 0; 294 | GCC_PREPROCESSOR_DEFINITIONS = ( 295 | "DEBUG=1", 296 | "$(inherited)", 297 | ); 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 305 | MTL_ENABLE_DEBUG_INFO = YES; 306 | ONLY_ACTIVE_ARCH = YES; 307 | SDKROOT = iphoneos; 308 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 309 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 310 | TARGETED_DEVICE_FAMILY = "1,2"; 311 | }; 312 | name = Debug; 313 | }; 314 | 5618053D1EAA132F004B5DE8 /* Release */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ALWAYS_SEARCH_USER_PATHS = NO; 318 | CLANG_ANALYZER_NONNULL = YES; 319 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 320 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 321 | CLANG_CXX_LIBRARY = "libc++"; 322 | CLANG_ENABLE_MODULES = YES; 323 | CLANG_ENABLE_OBJC_ARC = YES; 324 | CLANG_WARN_BOOL_CONVERSION = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 333 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 334 | CLANG_WARN_UNREACHABLE_CODE = YES; 335 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 336 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 337 | COPY_PHASE_STRIP = NO; 338 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 339 | ENABLE_NS_ASSERTIONS = NO; 340 | ENABLE_STRICT_OBJC_MSGSEND = YES; 341 | GCC_C_LANGUAGE_STANDARD = gnu99; 342 | GCC_NO_COMMON_BLOCKS = YES; 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 350 | MTL_ENABLE_DEBUG_INFO = NO; 351 | SDKROOT = iphoneos; 352 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 353 | TARGETED_DEVICE_FAMILY = "1,2"; 354 | VALIDATE_PRODUCT = YES; 355 | }; 356 | name = Release; 357 | }; 358 | 5618053F1EAA132F004B5DE8 /* Debug */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 362 | DEVELOPMENT_TEAM = 4RCKDZVQ59; 363 | INFOPLIST_FILE = IAImagePickerExample/Info.plist; 364 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 365 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 366 | PRODUCT_BUNDLE_IDENTIFIER = com.infinite.IAImagePickerExample; 367 | PRODUCT_NAME = "$(TARGET_NAME)"; 368 | SWIFT_VERSION = 3.0; 369 | }; 370 | name = Debug; 371 | }; 372 | 561805401EAA132F004B5DE8 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | DEVELOPMENT_TEAM = 4RCKDZVQ59; 377 | INFOPLIST_FILE = IAImagePickerExample/Info.plist; 378 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 380 | PRODUCT_BUNDLE_IDENTIFIER = com.infinite.IAImagePickerExample; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | SWIFT_VERSION = 3.0; 383 | }; 384 | name = Release; 385 | }; 386 | 561805421EAA132F004B5DE8 /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 390 | BUNDLE_LOADER = "$(TEST_HOST)"; 391 | DEVELOPMENT_TEAM = 4RCKDZVQ59; 392 | INFOPLIST_FILE = IAImagePickerExampleTests/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 394 | PRODUCT_BUNDLE_IDENTIFIER = com.infinite.IAImagePickerExampleTests; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | SWIFT_VERSION = 3.0; 397 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IAImagePickerExample.app/IAImagePickerExample"; 398 | }; 399 | name = Debug; 400 | }; 401 | 561805431EAA132F004B5DE8 /* Release */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 405 | BUNDLE_LOADER = "$(TEST_HOST)"; 406 | DEVELOPMENT_TEAM = 4RCKDZVQ59; 407 | INFOPLIST_FILE = IAImagePickerExampleTests/Info.plist; 408 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 409 | PRODUCT_BUNDLE_IDENTIFIER = com.infinite.IAImagePickerExampleTests; 410 | PRODUCT_NAME = "$(TARGET_NAME)"; 411 | SWIFT_VERSION = 3.0; 412 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IAImagePickerExample.app/IAImagePickerExample"; 413 | }; 414 | name = Release; 415 | }; 416 | /* End XCBuildConfiguration section */ 417 | 418 | /* Begin XCConfigurationList section */ 419 | 5618051C1EAA132E004B5DE8 /* Build configuration list for PBXProject "IAImagePickerExample" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | 5618053C1EAA132F004B5DE8 /* Debug */, 423 | 5618053D1EAA132F004B5DE8 /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | 5618053E1EAA132F004B5DE8 /* Build configuration list for PBXNativeTarget "IAImagePickerExample" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | 5618053F1EAA132F004B5DE8 /* Debug */, 432 | 561805401EAA132F004B5DE8 /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | 561805411EAA132F004B5DE8 /* Build configuration list for PBXNativeTarget "IAImagePickerExampleTests" */ = { 438 | isa = XCConfigurationList; 439 | buildConfigurations = ( 440 | 561805421EAA132F004B5DE8 /* Debug */, 441 | 561805431EAA132F004B5DE8 /* Release */, 442 | ); 443 | defaultConfigurationIsVisible = 0; 444 | defaultConfigurationName = Release; 445 | }; 446 | /* End XCConfigurationList section */ 447 | }; 448 | rootObject = 561805191EAA132E004B5DE8 /* Project object */; 449 | } 450 | -------------------------------------------------------------------------------- /IAImagePickerExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /IAImagePickerExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // IAImagePickerExample 4 | // 5 | // Created by preeti rani on 21/04/17. 6 | // Copyright © 2017 Innotical. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/album.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "album.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "album@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/album.imageset/album.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/album.imageset/album.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/album.imageset/album@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/album.imageset/album@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "camera.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "camera@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera.imageset/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera.imageset/camera.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera.imageset/camera@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera.imageset/camera@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "camera1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "camera1@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera1.imageset/camera1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera1.imageset/camera1.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera1.imageset/camera1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera1.imageset/camera1@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "camera2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "camera2@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera2.imageset/camera2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera2.imageset/camera2.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera2.imageset/camera2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera2.imageset/camera2@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "camera3.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "camera3@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera3.imageset/camera3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera3.imageset/camera3.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/camera3.imageset/camera3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/camera3.imageset/camera3@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/flashOFF.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "flashOFF.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "flashOFF@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/flashOFF.imageset/flashOFF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/flashOFF.imageset/flashOFF.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/flashOFF.imageset/flashOFF@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/flashOFF.imageset/flashOFF@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/flashON.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "flashON.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "flashON@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/flashON.imageset/flashON.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/flashON.imageset/flashON.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/flashON.imageset/flashON@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/flashON.imageset/flashON@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/image (1).imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "image (1).png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/image (1).imageset/image (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/image (1).imageset/image (1).png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/multiply.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "multiply.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "multiply@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/multiply.imageset/multiply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/multiply.imageset/multiply.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/multiply.imageset/multiply@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/multiply.imageset/multiply@2x.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/picture.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "picture-1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "image.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/picture.imageset/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/picture.imageset/image.png -------------------------------------------------------------------------------- /IAImagePickerExample/Assets.xcassets/picture.imageset/picture-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irshad281/IAImagePicker/d984dc43e60385974ef1a0ef323734ecf09b1f97/IAImagePickerExample/Assets.xcassets/picture.imageset/picture-1.png -------------------------------------------------------------------------------- /IAImagePickerExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /IAImagePickerExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /IAImagePickerExample/IAImagePicker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IAImagePicker.swift 3 | // IAImagePickerExample 4 | // 5 | // Created by preeti rani on 21/04/17. 6 | // Copyright © 2017 Innotical. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import AVFoundation 12 | import Photos 13 | @objc protocol IAImagePickerDelegate { 14 | @objc optional func didfinishPickingMediaInfo(mediaInfo: [String : Any] , pickedImage:UIImage?) 15 | } 16 | 17 | class IAImagePicker: NSObject , UIImagePickerControllerDelegate, UINavigationControllerDelegate{ 18 | 19 | var senderViewController:UIViewController? 20 | var imagePickerController:UIImagePickerController! 21 | var delegate:IAImagePickerDelegate? 22 | var allowEditing:Bool? = false 23 | static let sharedInstance = IAImagePicker.init() 24 | private override init() { 25 | super.init() 26 | imagePickerController = UIImagePickerController.init() 27 | imagePickerController.delegate = self 28 | } 29 | 30 | func presentIAImagePickerController(fromViewController:UIViewController) { 31 | self.senderViewController = fromViewController 32 | let pickerOptionSheet = UIAlertController.init(title: nil, message: nil, preferredStyle: .actionSheet) 33 | if UIImagePickerController.isSourceTypeAvailable(.camera){ 34 | let cameraAction = UIAlertAction.init(title: "Use Camera", style: .default) { (handler) in 35 | self.checkAvailablityOfCamera() 36 | } 37 | pickerOptionSheet.addAction(cameraAction) 38 | } 39 | 40 | if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){ 41 | let libraryAction = UIAlertAction.init(title: "Use Library", style: .default) { (handler) in 42 | self.checkAvalabilityOfPhotoLibrary() 43 | } 44 | pickerOptionSheet.addAction(libraryAction) 45 | } 46 | let cancelAction = UIAlertAction.init(title: "Cancel", style: .cancel) { (handler) in 47 | 48 | } 49 | pickerOptionSheet.addAction(cancelAction) 50 | DispatchQueue.main.async { 51 | fromViewController.present(pickerOptionSheet, animated: true, completion: nil) 52 | } 53 | } 54 | 55 | // MARK:- ImagePicket Delegate 56 | 57 | func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]){ 58 | var image:UIImage? 59 | if info["UIImagePickerControllerEditedImage"] != nil{ 60 | image = info["UIImagePickerControllerEditedImage"] as? UIImage 61 | }else if info["UIImagePickerControllerOriginalImage"] != nil{ 62 | image = info["UIImagePickerControllerOriginalImage"] as? UIImage 63 | } 64 | self.delegate?.didfinishPickingMediaInfo!(mediaInfo: info, pickedImage: image) 65 | picker.dismiss(animated: true, completion: nil) 66 | } 67 | 68 | func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { 69 | imagePickerController.dismiss(animated: true, completion: nil) 70 | } 71 | 72 | func openImagePicker(sourceType:UIImagePickerControllerSourceType){ 73 | imagePickerController.allowsEditing = allowEditing! 74 | imagePickerController.sourceType = sourceType 75 | senderViewController?.present(imagePickerController, animated: true, completion: nil) 76 | } 77 | 78 | func handleRestrictionofPermission(sourceType:UIImagePickerControllerSourceType){ 79 | var titleText:String? 80 | var messageText:String? 81 | if sourceType == .camera{ 82 | titleText = "Camera Access Denied" 83 | messageText = "This App don't allow to access camera at this time.To enable access , tap Setting and turn on camera" 84 | }else{ 85 | titleText = "Media Access Denied" 86 | messageText = "This App don't allow to access media at this time.To enable access , tap Setting and turn on Photos" 87 | } 88 | let alertController = UIAlertController.init(title: titleText, message: messageText, preferredStyle: .alert) 89 | let settingAction = UIAlertAction.init(title: "Setting", style: .destructive) { (handler) in 90 | DispatchQueue.main.async { 91 | UIApplication.shared.openURL(URL(string: UIApplicationOpenSettingsURLString)!) 92 | } 93 | } 94 | alertController.addAction(settingAction) 95 | 96 | let cancelAction = UIAlertAction.init(title: "Cancel", style: .cancel, handler: nil) 97 | alertController.addAction(cancelAction) 98 | DispatchQueue.main.async { 99 | self.senderViewController?.present(alertController, animated: true, completion: nil) 100 | } 101 | } 102 | 103 | func checkAvailablityOfCamera(){ 104 | let status = AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) 105 | if status == .authorized{ 106 | self.openImagePicker(sourceType: .camera) 107 | }else if status == .notDetermined{ 108 | AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo, completionHandler: { (success) in 109 | if success{ 110 | self.openImagePicker(sourceType: .camera) 111 | } 112 | }) 113 | }else{ 114 | self.handleRestrictionofPermission(sourceType: .camera) 115 | } 116 | } 117 | 118 | func checkAvalabilityOfPhotoLibrary(){ 119 | let status = PHPhotoLibrary.authorizationStatus() 120 | if status == .authorized{ 121 | self.openImagePicker(sourceType: .photoLibrary) 122 | }else if status == .notDetermined{ 123 | PHPhotoLibrary.requestAuthorization({ (handlerStatus) in 124 | if handlerStatus == .authorized{ 125 | self.openImagePicker(sourceType: .photoLibrary) 126 | } 127 | }) 128 | }else{ 129 | self.handleRestrictionofPermission(sourceType: .photoLibrary) 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /IAImagePickerExample/IAImagePickerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IAImagePickerViewController.swift 3 | // IAImagePickerExample 4 | // 5 | // Created by preeti rani on 26/04/17. 6 | // Copyright © 2017 Innotical. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Photos 11 | import AVFoundation 12 | 13 | 14 | let keyWindow = UIApplication.shared.keyWindow 15 | let screen_width = UIScreen.main.bounds.width 16 | let screen_height = UIScreen.main.bounds.height 17 | 18 | @objc protocol IAImagePickerDelegate1{ 19 | @objc optional func didFinishPickingMediaInfo(mediaInfo:[String:Any]? , pickedImage:UIImage?) 20 | @objc optional func didCancelIAPicker() 21 | } 22 | enum MediaType{ 23 | case camera 24 | case library 25 | } 26 | class PhotoCell: UICollectionViewCell { 27 | 28 | let photoImageView:UIImageView = { 29 | let imgView = UIImageView() 30 | imgView.contentMode = .scaleAspectFill 31 | imgView.clipsToBounds = true 32 | imgView.translatesAutoresizingMaskIntoConstraints = false 33 | imgView.isUserInteractionEnabled = true 34 | return imgView 35 | }() 36 | 37 | override init(frame: CGRect) { 38 | super.init(frame: frame) 39 | self.addSubview(photoImageView) 40 | self.backgroundColor = .clear 41 | self.photoImageView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 0).isActive = true 42 | self.photoImageView.rightAnchor.constraint(equalTo: self.rightAnchor, constant: 0).isActive = true 43 | self.photoImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: 0).isActive = true 44 | self.photoImageView.topAnchor.constraint(equalTo: self.topAnchor, constant: 0).isActive = true 45 | } 46 | required init?(coder aDecoder: NSCoder) { 47 | fatalError("init(coder:) has not been implemented") 48 | } 49 | } 50 | 51 | class IAImagePickerViewController: UIViewController , UICollectionViewDelegate , UICollectionViewDataSource , UIImagePickerControllerDelegate , UINavigationControllerDelegate{ 52 | 53 | let name = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String 54 | var captureSession: AVCaptureSession?; 55 | var previewLayer : AVCaptureVideoPreviewLayer?; 56 | var captureDevice : AVCaptureDevice? 57 | var stillImageOutput:AVCaptureStillImageOutput? 58 | 59 | var photosArray = [PhotoModel]() 60 | var orignalframe:CGRect? 61 | var delegate:IAImagePickerDelegate1? 62 | var capturedImageView:UIImageView? 63 | var restrictionView:UIView! 64 | var activity:UIActivityIndicatorView = UIActivityIndicatorView() 65 | lazy var cameraView:UIView = { 66 | let view = UIView.init(frame:CGRect.init(x: 0, y: 0, width: screen_width, height: screen_height)) 67 | view.backgroundColor = .white 68 | return view 69 | }() 70 | 71 | lazy var photoCollectionView:UICollectionView = { 72 | let flowLayout = UICollectionViewFlowLayout.init() 73 | flowLayout.minimumLineSpacing = 5 74 | flowLayout.itemSize = CGSize(width: 100, height: 100) 75 | flowLayout.scrollDirection = .horizontal 76 | let frame = CGRect.init(x: 0, y: screen_height - 200, width: screen_width, height: 100) 77 | let photoCollectionView = UICollectionView.init(frame: frame, collectionViewLayout: flowLayout) 78 | photoCollectionView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0) 79 | photoCollectionView.register(PhotoCell.self, forCellWithReuseIdentifier: "cellId") 80 | photoCollectionView.backgroundColor = .clear 81 | photoCollectionView.delegate = self 82 | photoCollectionView.dataSource = self 83 | return photoCollectionView 84 | }() 85 | 86 | lazy var crossButton:UIButton = { 87 | let crossButton = UIButton.init(frame:CGRect.init(x: 20, y: 20, width: 30, height: 30)) 88 | crossButton.tintColor = .clear 89 | crossButton.addTarget(self, action: #selector(self.handleCancel(_:)), for: .touchUpInside) 90 | crossButton.setImage(#imageLiteral(resourceName: "multiply"), for: .normal) 91 | return crossButton 92 | }() 93 | 94 | lazy var flashButton:UIButton = { 95 | let flashButton = UIButton.init(frame:CGRect.init(x: screen_width - 50, y: 20, width: 30, height: 30)) 96 | flashButton.setImage(#imageLiteral(resourceName: "flashON"), for: .normal) 97 | flashButton.setImage(#imageLiteral(resourceName: "flashOFF"), for: .selected) 98 | flashButton.tintColor = .clear 99 | flashButton.addTarget(self, action: #selector(self.handleFlash(_:)), for: .touchUpInside) 100 | return flashButton 101 | }() 102 | 103 | lazy var captureButton:UIButton = { 104 | let button = UIButton.init(frame: CGRect.init(x: 2, y: 2, width: 46, height: 46)) 105 | button.translatesAutoresizingMaskIntoConstraints = false 106 | button.backgroundColor = .white 107 | button.layer.cornerRadius = 23 108 | button.clipsToBounds = true 109 | button.addTarget(self, action: #selector(self.handleCapture(_:)), for: .touchUpInside) 110 | return button 111 | }() 112 | 113 | lazy var useImageButton:UIButton = { 114 | let button = UIButton.init(frame: CGRect.init(x: screen_width - 120, y: screen_height - 50, width: 100, height: 30)) 115 | button.setTitleColor(.white, for: .normal) 116 | button.titleLabel?.font = UIFont.init(name: "Helvetica Neue", size: 15) 117 | button.setTitle("USE PHOTO", for: .normal) 118 | button.layer.cornerRadius = 3 119 | button.layer.borderWidth = 1.0 120 | button.backgroundColor = .black 121 | button.layer.borderColor = UIColor.white.cgColor 122 | button.clipsToBounds = true 123 | button.addTarget(self, action: #selector(self.handleUseImage(_:)), for: .touchUpInside) 124 | return button 125 | }() 126 | 127 | lazy var retakeButton:UIButton = { 128 | let button = UIButton.init(frame: CGRect.init(x: 20, y: screen_height - 50, width: 80, height: 30)) 129 | button.setTitleColor(.white, for: .normal) 130 | button.backgroundColor = .black 131 | button.titleLabel?.font = UIFont.init(name: "Helvetica Neue", size: 15) 132 | button.setTitle("RETAKE", for: .normal) 133 | button.layer.cornerRadius = 3 134 | button.layer.borderWidth = 1.0 135 | button.layer.borderColor = UIColor.white.cgColor 136 | button.clipsToBounds = true 137 | button.addTarget(self, action: #selector(self.handleRetakePhoto(_:)), for: .touchUpInside) 138 | return button 139 | }() 140 | 141 | lazy var captureView:UIView = { 142 | let captureView = UIView.init(frame: CGRect.init(x: screen_width/2 - 25, y: screen_height - 70, width: 60, height: 60)) 143 | captureView.backgroundColor = .black 144 | captureView.layer.cornerRadius = 30 145 | captureView.clipsToBounds = true 146 | captureView.layer.borderWidth = 5 147 | captureView.layer.borderColor = UIColor.white.cgColor 148 | let button = UIButton.init(frame: CGRect.init(x: 7.5, y: 7.5, width: 45, height: 45)) 149 | button.backgroundColor = .white 150 | button.layer.cornerRadius = 22.5 151 | button.clipsToBounds = true 152 | button.addTarget(self, action: #selector(self.handleCapture(_:)), for: .touchUpInside) 153 | captureView.addSubview(button) 154 | return captureView 155 | }() 156 | 157 | lazy var albumButton:UIButton={ 158 | let albumButton = UIButton.init(frame:CGRect.init(x: 15, y: screen_height - 55, width: 45, height: 30)) 159 | albumButton.setImage(#imageLiteral(resourceName: "picture"), for: .normal) 160 | albumButton.addTarget(self, action: #selector(self.hanldleOpenAlbum(_:)), for: .touchUpInside) 161 | return albumButton 162 | }() 163 | 164 | func openSetting(_ sender:UIButton) { 165 | print("Open Setting...") 166 | let name = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String 167 | print(name) 168 | UIApplication.shared.openURL(URL(string: UIApplicationOpenSettingsURLString)!) 169 | } 170 | override func viewDidLoad() { 171 | super.viewDidLoad() 172 | self.flushSessionData() 173 | self.view.backgroundColor = #colorLiteral(red: 0.9803921569, green: 0.9803921569, blue: 0.9803921569, alpha: 1) 174 | self.captureSession = AVCaptureSession(); 175 | self.previewLayer = AVCaptureVideoPreviewLayer(); 176 | self.captureSession?.sessionPreset = AVCaptureSessionPresetHigh 177 | self.stillImageOutput = AVCaptureStillImageOutput() 178 | self.stillImageOutput?.outputSettings = [AVVideoCodecKey:AVVideoCodecJPEG] 179 | self.photoCollectionView.reloadData() 180 | _ = self.checkAutherizationStatusForCameraAndPhotoLibrary() 181 | } 182 | 183 | func addAfterPermission() { 184 | accessPhotosFromLibrary() 185 | let devices = AVCaptureDevice.devices() 186 | // Loop through all the capture devices on this phone 187 | for device in devices! { 188 | // Make sure this particular device supports video 189 | if ((device as AnyObject).hasMediaType(AVMediaTypeVideo)) { 190 | // Finally check the position and confirm we've got the back camera 191 | if((device as AnyObject).position == AVCaptureDevicePosition.back) { 192 | self.captureDevice = device as? AVCaptureDevice 193 | if self.captureDevice != nil { 194 | self.beginSession() 195 | } 196 | } 197 | } 198 | } 199 | } 200 | override func viewDidAppear(_ animated: Bool) { 201 | super.viewDidAppear(animated) 202 | } 203 | 204 | func setUpViews(){ 205 | DispatchQueue.main.async { 206 | self.cameraView.addSubview(self.crossButton) 207 | self.cameraView.addSubview(self.flashButton) 208 | self.cameraView.addSubview(self.albumButton) 209 | self.cameraView.addSubview(self.captureView) 210 | self.cameraView.addSubview(self.photoCollectionView) 211 | } 212 | } 213 | 214 | func checkAutherizationStatusForCameraAndPhotoLibrary()->Bool{ 215 | var permissionStatus:Bool! = false 216 | let libraryPermission = PHPhotoLibrary.authorizationStatus() 217 | let cameraPermission = AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) 218 | 219 | if libraryPermission == .notDetermined || cameraPermission == .notDetermined{ 220 | PHPhotoLibrary.requestAuthorization({ (handlerStatus) in 221 | if handlerStatus == .authorized{ 222 | if cameraPermission == .notDetermined{ 223 | self.checkPermissionForCamera() 224 | } 225 | permissionStatus = true 226 | }else{ 227 | self.checkPermissionForCamera() 228 | permissionStatus = false 229 | } 230 | }) 231 | }else{ 232 | if libraryPermission == .authorized && cameraPermission == .authorized{ 233 | DispatchQueue.main.async { 234 | self.photoCollectionView.reloadData() 235 | self.view.addSubview(self.cameraView) 236 | self.addAfterPermission() 237 | } 238 | }else{ 239 | self.showRestrictionView(mediaType: .library) 240 | } 241 | } 242 | return permissionStatus 243 | } 244 | 245 | func showRestrictionView(mediaType:MediaType){ 246 | if restrictionView != nil{ 247 | restrictionView.removeFromSuperview() 248 | restrictionView = nil 249 | } 250 | DispatchQueue.main.async { 251 | self.restrictionView = UIView.init(frame: UIScreen.main.bounds) 252 | self.restrictionView.backgroundColor = .white 253 | let imageView = UIImageView.init(frame: CGRect(x: screen_width/2 - 75, y: screen_height/2 - 145, width: 150, height: 150)) 254 | if mediaType == .camera{ 255 | imageView.image = #imageLiteral(resourceName: "camera3") 256 | }else{ 257 | imageView.image = #imageLiteral(resourceName: "album") 258 | } 259 | self.restrictionView.addSubview(imageView) 260 | let permissionDescriptionLable = UILabel.init(frame: CGRect.init(x: 10, y: screen_height/2 + 25, width: screen_width - 20, height: 60)) 261 | permissionDescriptionLable.numberOfLines = 0 262 | permissionDescriptionLable.textColor = #colorLiteral(red: 0.1019607843, green: 0.3098039216, blue: 0.5098039216, alpha: 1) 263 | permissionDescriptionLable.textAlignment = .center 264 | permissionDescriptionLable.font = UIFont.init(name: "Helvetica Neue", size: 13) 265 | permissionDescriptionLable.text = "Allow \(self.name) access to your camera to take photos within app.Go to Setting and turn on Photo and Camera" 266 | self.restrictionView.addSubview(permissionDescriptionLable) 267 | let openSettingButton = UIButton.init(frame: CGRect.init(x: screen_width/2 - 60, y: screen_height/2 + 105, width: 120, height: 30)) 268 | openSettingButton.setTitle("Open Setting", for: .normal) 269 | openSettingButton.setTitleColor(#colorLiteral(red: 0.1019607843, green: 0.3098039216, blue: 0.5098039216, alpha: 1), for: .normal) 270 | openSettingButton.addTarget(self, action: #selector(self.openSetting(_:)), for: .touchUpInside) 271 | self.restrictionView.addSubview(openSettingButton) 272 | self.view.addSubview(self.restrictionView) 273 | self.view.bringSubview(toFront: self.restrictionView) 274 | } 275 | } 276 | 277 | func checkPermissionForCamera(){ 278 | AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo, completionHandler: { (success) in 279 | if success{ 280 | if let window = keyWindow{ 281 | DispatchQueue.main.async { 282 | self.photoCollectionView.reloadData() 283 | window.addSubview(self.cameraView) 284 | self.addAfterPermission() 285 | } 286 | } 287 | }else{ 288 | DispatchQueue.main.async { 289 | self.showRestrictionView(mediaType: .library) 290 | } 291 | } 292 | }) 293 | } 294 | 295 | 296 | func configureDevice(flashMode:AVCaptureFlashMode) { 297 | if let device = captureDevice { 298 | do { 299 | try device.lockForConfiguration() 300 | if device.isFocusPointOfInterestSupported{ 301 | device.focusMode = .continuousAutoFocus 302 | device.flashMode = flashMode 303 | } 304 | device.unlockForConfiguration() 305 | } catch { 306 | print(error.localizedDescription) 307 | } 308 | } 309 | } 310 | 311 | func beginSession() { 312 | if (captureSession?.canAddOutput(stillImageOutput))! { 313 | captureSession?.addOutput(stillImageOutput) 314 | } 315 | configureDevice(flashMode: .auto) 316 | do { 317 | captureSession?.startRunning() 318 | captureSession?.addInput(try AVCaptureDeviceInput(device: captureDevice)) 319 | previewLayer = AVCaptureVideoPreviewLayer(session: captureSession) 320 | previewLayer?.frame = cameraView.layer.frame 321 | 322 | self.cameraView.layer.addSublayer(self.previewLayer!) 323 | self.setUpViews() 324 | } catch{ 325 | print(error.localizedDescription) 326 | } 327 | } 328 | 329 | func handleFlash(_ sender:UIButton){ 330 | if sender.isSelected{ 331 | self.configureDevice(flashMode: .auto) 332 | }else{ 333 | self.configureDevice(flashMode: .off) 334 | } 335 | sender.isSelected = !sender.isSelected 336 | } 337 | 338 | func handleCancel(_ sender:UIButton){ 339 | print("Handling dismiss.....") 340 | UIView.animate(withDuration: 0.5, animations: { 341 | self.cameraView.frame = CGRect(x: 0, y: screen_height, width: screen_width, height: screen_height) 342 | self.dismiss(animated: true, completion: nil) 343 | }) { (completed) in 344 | self.cameraView.removeFromSuperview() 345 | } 346 | } 347 | 348 | func handleUseImage(_ sender:UIButton){ 349 | print("Handling UseImage.....") 350 | if let capturedImage = self.zoomedImageView{ 351 | UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.5, options: .curveEaseOut, animations: { 352 | self.cameraView.removeFromSuperview() 353 | capturedImage.frame = CGRect(x: 0, y: screen_height, width: screen_width, height: screen_height) 354 | self.delegate?.didFinishPickingMediaInfo!(mediaInfo: nil, pickedImage: self.zoomedImageView?.image) 355 | self.dismiss(animated: true, completion: nil) 356 | self.retakeButton.removeFromSuperview() 357 | self.useImageButton.removeFromSuperview() 358 | }, completion: { (completed) in 359 | self.zoomedImageView?.removeFromSuperview() 360 | self.zoomedImageView = nil 361 | }) 362 | } 363 | 364 | if let capturedPhoto = self.capturedImageView{ 365 | UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.5, options: .curveEaseOut, animations: { 366 | self.cameraView.removeFromSuperview() 367 | capturedPhoto.frame = CGRect(x: 0, y: screen_height, width: screen_width, height: screen_height) 368 | self.delegate?.didFinishPickingMediaInfo!(mediaInfo: nil, pickedImage: capturedPhoto.image) 369 | self.dismiss(animated: true, completion: nil) 370 | self.retakeButton.removeFromSuperview() 371 | self.useImageButton.removeFromSuperview() 372 | }, completion: { (completed) in 373 | self.zoomedImageView?.removeFromSuperview() 374 | self.zoomedImageView = nil 375 | }) 376 | } 377 | } 378 | 379 | func handleRetakePhoto(_ sender:UIButton){ 380 | print("Handling Retake.....") 381 | if let capturedImage = self.capturedImageView{ 382 | UIView.animate(withDuration: 0.33, animations: { 383 | capturedImage.frame = CGRect(x: 0, y: screen_height, width: screen_width, height: screen_height) 384 | self.retakeButton.removeFromSuperview() 385 | self.useImageButton.removeFromSuperview() 386 | }, completion: { (completed) in 387 | self.capturedImageView?.removeFromSuperview() 388 | self.capturedImageView = nil 389 | }) 390 | } 391 | if let capturedPhoto = self.zoomedImageView{ 392 | UIView.animate(withDuration: 0.33, animations: { 393 | capturedPhoto.frame = self.orignalframe! 394 | self.retakeButton.removeFromSuperview() 395 | self.useImageButton.removeFromSuperview() 396 | }, completion: { (completed) in 397 | self.orignalImageView?.isHidden = false 398 | self.zoomedImageView?.removeFromSuperview() 399 | self.zoomedImageView = nil 400 | }) 401 | } 402 | } 403 | 404 | func flushSessionData(){ 405 | captureSession = nil 406 | captureDevice = nil 407 | previewLayer?.removeFromSuperlayer() 408 | previewLayer = nil 409 | stillImageOutput = nil 410 | } 411 | 412 | 413 | func handleCapture(_ sender:UIButton){ 414 | print("Handling capture.....") 415 | UIView.animate(withDuration: 0.33, animations: { 416 | self.captureView.transform = CGAffineTransform(scaleX: 1.25, y: 1.25) 417 | }) { (completed) in 418 | self.captureView.transform = .identity 419 | if let videoConnection = self.stillImageOutput?.connection(withMediaType: AVMediaTypeVideo) { 420 | self.stillImageOutput?.captureStillImageAsynchronously(from: videoConnection) { 421 | (imageDataSampleBuffer, error) -> Void in 422 | if let imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageDataSampleBuffer){ 423 | let image = UIImage.init(data: imageData) 424 | self.capturedImageView = UIImageView.init(frame: UIScreen.main.bounds) 425 | self.capturedImageView?.image = image 426 | keyWindow?.addSubview(self.capturedImageView!) 427 | keyWindow?.addSubview(self.useImageButton) 428 | keyWindow?.addSubview(self.retakeButton) 429 | UIImageWriteToSavedPhotosAlbum(UIImage(data: imageData)!, nil, nil, nil) 430 | } 431 | } 432 | } 433 | } 434 | } 435 | 436 | func hanldleOpenAlbum(_ sender:UIButton){ 437 | print("Handling OpenAlbum.....") 438 | let imagePickerController = UIImagePickerController.init() 439 | imagePickerController.sourceType = .photoLibrary 440 | imagePickerController.allowsEditing = true 441 | imagePickerController.delegate = self 442 | UIView.animate(withDuration: 0.50, delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 0.3, options: .curveEaseOut, animations: { 443 | self.cameraView.frame = CGRect(x: 0, y: screen_height, width: screen_width, height: screen_height) 444 | self.present(imagePickerController, animated: false, completion: nil) 445 | }, completion: { (completed) in 446 | self.cameraView.removeFromSuperview() 447 | }) 448 | 449 | } 450 | 451 | func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { 452 | var image:UIImage? 453 | if info["UIImagePickerControllerEditedImage"] != nil{ 454 | image = info["UIImagePickerControllerEditedImage"] as? UIImage 455 | }else if info["UIImagePickerControllerOriginalImage"] != nil{ 456 | image = info["UIImagePickerControllerOriginalImage"] as? UIImage 457 | } 458 | self.delegate?.didFinishPickingMediaInfo!(mediaInfo: info, pickedImage: image) 459 | picker.dismiss(animated: false, completion: nil) 460 | self.dismiss(animated: true, completion: nil) 461 | } 462 | 463 | func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { 464 | picker.dismiss(animated: false, completion: nil) 465 | self.dismiss(animated: true, completion: nil) 466 | } 467 | 468 | func accessPhotosFromLibrary(){ 469 | let fetchOption = PHFetchOptions.init() 470 | fetchOption.fetchLimit = 100 471 | fetchOption.sortDescriptors = [NSSortDescriptor.init(key: "creationDate", ascending: false)] 472 | let assets = PHAsset.fetchAssets(with: PHAssetMediaType.image, options: fetchOption) 473 | assets.enumerateObjects(options: .concurrent) { (assest, id, bool) in 474 | self.photosArray.append(PhotoModel.getAssestsModel(assest: assest)) 475 | } 476 | } 477 | 478 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 479 | return photosArray.count 480 | } 481 | 482 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 483 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellId", for: indexPath) as! PhotoCell 484 | cell.photoImageView.image = self.photosArray[indexPath.item].photoImage 485 | cell.photoImageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(handleTap(tap:)))) 486 | return cell 487 | } 488 | 489 | var orignalImageView:UIImageView? 490 | var selectedAssest:PhotoModel? 491 | var zoomedImageView:UIImageView? 492 | func handleTap(tap:UITapGestureRecognizer){ 493 | if let indexPath = getIndexFromCollectionViewCell(tap.view!, collView: photoCollectionView){ 494 | print(indexPath.item) 495 | selectedAssest = photosArray[indexPath.item] 496 | orignalImageView = tap.view as? UIImageView 497 | orignalImageView?.isHidden = true 498 | orignalframe = orignalImageView?.convert((orignalImageView?.frame)!, to: nil) 499 | if zoomedImageView != nil{ 500 | zoomedImageView?.removeFromSuperview() 501 | zoomedImageView = nil 502 | } 503 | zoomedImageView = UIImageView.init(frame: orignalframe!) 504 | zoomedImageView?.contentMode = .scaleAspectFill 505 | zoomedImageView?.clipsToBounds = true 506 | zoomedImageView?.isUserInteractionEnabled = true 507 | zoomedImageView?.addGestureRecognizer(UIPanGestureRecognizer.init(target: self, action: #selector(handlePan(pan:)))) 508 | zoomedImageView?.image = getAssetThumbnail(asset: (selectedAssest?.assest!)!, size: PHImageManagerMaximumSize) 509 | keyWindow?.addSubview(zoomedImageView!) 510 | UIView.animate(withDuration: 0.5, animations: { 511 | self.zoomedImageView?.frame = self.view.frame 512 | }, completion: { (completed) in 513 | keyWindow?.addSubview(self.useImageButton) 514 | keyWindow?.addSubview(self.retakeButton) 515 | }) 516 | } 517 | 518 | } 519 | 520 | func handlePan(pan:UIPanGestureRecognizer){ 521 | if pan.state == .began || pan.state == .changed { 522 | let translation = pan.translation(in: self.view) 523 | let piont = CGPoint(x: pan.view!.center.x + translation.x, y: pan.view!.center.y + translation.y) 524 | print("POINT",piont) 525 | pan.view!.center = piont 526 | pan.setTranslation(CGPoint.zero, in: self.view) 527 | self.retakeButton.alpha = 0 528 | self.useImageButton.alpha = 0 529 | }else if pan.state == .ended{ 530 | if let yPosition = pan.view?.center.y{ 531 | print("Y Position ",yPosition) 532 | let maxDownpoint = self.view.frame.height - self.view.frame.height/4 533 | print("MAX DOWN POINT",maxDownpoint) 534 | if yPosition >= maxDownpoint{ 535 | dismissZoomedImageView() 536 | }else{ 537 | UIView.animate(withDuration: 0.33, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0.3, options: .curveLinear, animations: { 538 | self.zoomedImageView?.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height) 539 | self.retakeButton.alpha = 1 540 | self.useImageButton.alpha = 1 541 | }, completion: { (success) in 542 | 543 | }) 544 | } 545 | } 546 | } 547 | } 548 | 549 | func dismissZoomedImageView(){ 550 | UIView.animate(withDuration: 0.33, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.3, options: .curveLinear, animations: { 551 | self.zoomedImageView?.frame = self.orignalframe! 552 | self.useImageButton.removeFromSuperview() 553 | self.retakeButton.removeFromSuperview() 554 | }, completion: { (success) in 555 | self.zoomedImageView?.removeFromSuperview() 556 | self.zoomedImageView = nil 557 | self.orignalImageView?.isHidden = false 558 | self.useImageButton.alpha = 1 559 | self.retakeButton.alpha = 1 560 | }) 561 | } 562 | } 563 | 564 | func getAssetThumbnail(asset: PHAsset , size:CGSize) -> UIImage { 565 | let manager = PHImageManager.default() 566 | let option = PHImageRequestOptions() 567 | var thumbnail = UIImage() 568 | option.isSynchronous = true 569 | option.resizeMode = .exact 570 | option.deliveryMode = .fastFormat 571 | manager.requestImage(for: asset, targetSize: size, contentMode: .default, options: option, resultHandler: {(result, info)->Void in 572 | thumbnail = result! 573 | }) 574 | return thumbnail 575 | } 576 | 577 | func getIndexFromCollectionViewCell(_ cellItem: UIView, collView: UICollectionView) -> IndexPath? { 578 | let pointInTable: CGPoint = cellItem.convert(cellItem.bounds.origin, to: collView) 579 | if let cellIndexPath = collView.indexPathForItem(at: pointInTable){ 580 | return cellIndexPath 581 | } 582 | return nil 583 | } 584 | 585 | class PhotoModel: NSObject { 586 | var photoImage:UIImage? 587 | var assest:PHAsset? 588 | 589 | static func getAssestsModel(assest:PHAsset)->PhotoModel{ 590 | let photoModel = PhotoModel.init() 591 | photoModel.assest = assest 592 | photoModel.photoImage = getAssetThumbnail(asset: assest, size: CGSize(width: 250, height: 250)) 593 | return photoModel 594 | } 595 | } 596 | 597 | -------------------------------------------------------------------------------- /IAImagePickerExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | NSCameraUsageDescription 45 | App uses camera to access Photo 46 | NSPhotoLibraryUsageDescription 47 | App uses Library to Access Photo 48 | 49 | 50 | -------------------------------------------------------------------------------- /IAImagePickerExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // IAImagePickerExample 4 | // 5 | // Created by preeti rani on 21/04/17. 6 | // Copyright © 2017 Innotical. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewControler:UIViewController , IAImagePickerDelegate1{ 12 | 13 | @IBOutlet weak var imageView: UIImageView! 14 | override func viewDidLoad() { 15 | imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(handleTap(tap:)))) 16 | } 17 | 18 | override func viewWillAppear(_ animated: Bool) { 19 | super.viewWillAppear(animated) 20 | 21 | } 22 | 23 | func handleTap(tap:UITapGestureRecognizer) { 24 | let imagePicker = IAImagePickerViewController() 25 | imagePicker.delegate = self 26 | DispatchQueue.main.async { 27 | self.present(imagePicker, animated: false, completion: nil) 28 | } 29 | } 30 | 31 | func didFinishPickingMediaInfo(mediaInfo: [String : Any]?, pickedImage: UIImage?) { 32 | if let image = pickedImage{ 33 | self.imageView.image = image 34 | } 35 | } 36 | } 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /IAImagePickerExampleTests/IAImagePickerExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IAImagePickerExampleTests.swift 3 | // IAImagePickerExampleTests 4 | // 5 | // Created by preeti rani on 21/04/17. 6 | // Copyright © 2017 Innotical. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import IAImagePickerExample 11 | 12 | class IAImagePickerExampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /IAImagePickerExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Irshad Ahmed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IAImagePicker 2 | 3 | A very Simple Image Picker that handles All the permissions of user like denied , allowed , restricted 4 | 5 | # HOW TO USE? 6 | Download the project and add the IAImagePickerViewController file to your Project 7 | 8 | let imagePicker = IAImagePickerViewController.sharedInstance 9 | 10 | imagePicker.delegate = self 11 | 12 | imagePicker.presentIAImagePickerController(fromViewController: self) 13 | 14 | # CameraView 15 | 16 | ![alt text](http://i.imgur.com/akHbNiV.png) 17 | 18 | # Picked Image 19 | 20 | ![alt text](http://i.imgur.com/tydDw9B.png) 21 | 22 | 23 | ![alt text](http://i.imgur.com/46H9Xv0.png) 24 | 25 | 26 | # Gallary 27 | 28 | 29 | ![alt text](http://i.imgur.com/wFxO5zb.png) 30 | 31 | 32 | # when user dont allow access to camera or Photo Library 33 | 34 | 35 | ![alt text](http://i.imgur.com/kq20SQp.png) 36 | 37 | 38 | 39 | # IAImagePickerdelegate 40 | 41 | when user select the image this function will be called mediaInfo contain image url , edited image and other information 42 | 43 | 44 | func didfinishPickingMediaInfo(mediaInfo: [String : Any], pickedImage: UIImage?) { 45 | } 46 | --------------------------------------------------------------------------------