diff --git a/.DS_Store b/.DS_Store index 03d0600..6c25a14 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Example/Athlee-ImagePicker/Athlee-ImagePicker.xcodeproj/project.pbxproj b/Example/Athlee-ImagePicker/Athlee-ImagePicker.xcodeproj/project.pbxproj index 60f4a15..7f653b6 100644 --- a/Example/Athlee-ImagePicker/Athlee-ImagePicker.xcodeproj/project.pbxproj +++ b/Example/Athlee-ImagePicker/Athlee-ImagePicker.xcodeproj/project.pbxproj @@ -13,27 +13,29 @@ 040D62E41D36A990003F8D8E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 040D62E31D36A990003F8D8E /* Assets.xcassets */; }; 040D62E71D36A990003F8D8E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 040D62E51D36A990003F8D8E /* LaunchScreen.storyboard */; }; 040D62F21D36A991003F8D8E /* Athlee_ImagePickerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040D62F11D36A991003F8D8E /* Athlee_ImagePickerTests.swift */; }; - 041D01E31D398B1400D2EB81 /* Capturable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041D01E21D398B1400D2EB81 /* Capturable.swift */; }; - 041D01E51D398F0D00D2EB81 /* CaptureNotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041D01E41D398F0D00D2EB81 /* CaptureNotificationObserver.swift */; }; 041D01E71D39910900D2EB81 /* CaptureViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041D01E61D39910900D2EB81 /* CaptureViewController.swift */; }; - 041D01E91D39980700D2EB81 /* PhotoCapturable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041D01E81D39980700D2EB81 /* PhotoCapturable.swift */; }; - 049AF4431D3875080097959B /* CGRect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF4391D3875080097959B /* CGRect.swift */; }; - 049AF4441D3875080097959B /* CollectionViewChangeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF43A1D3875080097959B /* CollectionViewChangeObserver.swift */; }; - 049AF4451D3875080097959B /* Cropable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF43B1D3875080097959B /* Cropable.swift */; }; - 049AF4461D3875080097959B /* CropableScrollViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF43C1D3875080097959B /* CropableScrollViewDelegate.swift */; }; - 049AF4471D3875080097959B /* FloatingViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF43D1D3875080097959B /* FloatingViewLayout.swift */; }; - 049AF4481D3875080097959B /* LinesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF43E1D3875080097959B /* LinesView.swift */; }; - 049AF4491D3875080097959B /* NSIndexSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF43F1D3875080097959B /* NSIndexSet.swift */; }; - 049AF44A1D3875080097959B /* PhotoCachable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF4401D3875080097959B /* PhotoCachable.swift */; }; - 049AF44B1D3875080097959B /* PhotoFetchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF4411D3875080097959B /* PhotoFetchable.swift */; }; - 049AF44C1D3875080097959B /* UICollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF4421D3875080097959B /* UICollectionView.swift */; }; + 0452DAE51DEB77D8009EFE32 /* Capturable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAD51DEB77D8009EFE32 /* Capturable.swift */; }; + 0452DAE61DEB77D8009EFE32 /* CaptureNotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAD61DEB77D8009EFE32 /* CaptureNotificationObserver.swift */; }; + 0452DAE71DEB77D8009EFE32 /* CGAffineTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAD71DEB77D8009EFE32 /* CGAffineTransform.swift */; }; + 0452DAE81DEB77D8009EFE32 /* CGRect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAD81DEB77D8009EFE32 /* CGRect.swift */; }; + 0452DAE91DEB77D8009EFE32 /* CollectionViewChangeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAD91DEB77D8009EFE32 /* CollectionViewChangeObserver.swift */; }; + 0452DAEA1DEB77D8009EFE32 /* Cropable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DADA1DEB77D8009EFE32 /* Cropable.swift */; }; + 0452DAEB1DEB77D8009EFE32 /* CropableScrollViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DADB1DEB77D8009EFE32 /* CropableScrollViewDelegate.swift */; }; + 0452DAEC1DEB77D8009EFE32 /* FloatingViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DADC1DEB77D8009EFE32 /* FloatingViewLayout.swift */; }; + 0452DAED1DEB77D8009EFE32 /* LinesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DADD1DEB77D8009EFE32 /* LinesView.swift */; }; + 0452DAEE1DEB77D8009EFE32 /* NSIndexSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DADE1DEB77D8009EFE32 /* NSIndexSet.swift */; }; + 0452DAEF1DEB77D8009EFE32 /* PhotoCachable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DADF1DEB77D8009EFE32 /* PhotoCachable.swift */; }; + 0452DAF01DEB77D8009EFE32 /* PhotoCapturable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAE01DEB77D8009EFE32 /* PhotoCapturable.swift */; }; + 0452DAF11DEB77D8009EFE32 /* PhotoFetchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAE11DEB77D8009EFE32 /* PhotoFetchable.swift */; }; + 0452DAF21DEB77D8009EFE32 /* Radians.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAE21DEB77D8009EFE32 /* Radians.swift */; }; + 0452DAF31DEB77D8009EFE32 /* UICollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAE31DEB77D8009EFE32 /* UICollectionView.swift */; }; + 0452DAF41DEB77D8009EFE32 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0452DAE41DEB77D8009EFE32 /* UIView.swift */; }; 049AF44E1D38756F0097959B /* HolderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF44D1D38756F0097959B /* HolderViewController.swift */; }; 049AF4501D3876050097959B /* CropViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF44F1D3876050097959B /* CropViewController.swift */; }; 049AF4551D387EFC0097959B /* PhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF4541D387EFC0097959B /* PhotoCell.swift */; }; 049AF4571D387F2F0097959B /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF4561D387F2F0097959B /* PhotoViewController.swift */; }; 049AF4591D387F840097959B /* ContainerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF4581D387F840097959B /* ContainerType.swift */; }; 049AF45B1D38B8160097959B /* SelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF45A1D38B8160097959B /* SelectionViewController.swift */; }; - 049AF45D1D38BF670097959B /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AF45C1D38BF670097959B /* UIView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -57,27 +59,29 @@ 040D62ED1D36A991003F8D8E /* Athlee-ImagePickerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Athlee-ImagePickerTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 040D62F11D36A991003F8D8E /* Athlee_ImagePickerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Athlee_ImagePickerTests.swift; sourceTree = ""; }; 040D62F31D36A991003F8D8E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 041D01E21D398B1400D2EB81 /* Capturable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Capturable.swift; sourceTree = ""; }; - 041D01E41D398F0D00D2EB81 /* CaptureNotificationObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureNotificationObserver.swift; sourceTree = ""; }; 041D01E61D39910900D2EB81 /* CaptureViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureViewController.swift; sourceTree = ""; }; - 041D01E81D39980700D2EB81 /* PhotoCapturable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCapturable.swift; sourceTree = ""; }; - 049AF4391D3875080097959B /* CGRect.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGRect.swift; sourceTree = ""; }; - 049AF43A1D3875080097959B /* CollectionViewChangeObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewChangeObserver.swift; sourceTree = ""; }; - 049AF43B1D3875080097959B /* Cropable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cropable.swift; sourceTree = ""; }; - 049AF43C1D3875080097959B /* CropableScrollViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropableScrollViewDelegate.swift; sourceTree = ""; }; - 049AF43D1D3875080097959B /* FloatingViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FloatingViewLayout.swift; sourceTree = ""; }; - 049AF43E1D3875080097959B /* LinesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinesView.swift; sourceTree = ""; }; - 049AF43F1D3875080097959B /* NSIndexSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSIndexSet.swift; sourceTree = ""; }; - 049AF4401D3875080097959B /* PhotoCachable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCachable.swift; sourceTree = ""; }; - 049AF4411D3875080097959B /* PhotoFetchable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoFetchable.swift; sourceTree = ""; }; - 049AF4421D3875080097959B /* UICollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionView.swift; sourceTree = ""; }; + 0452DAD51DEB77D8009EFE32 /* Capturable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Capturable.swift; sourceTree = ""; }; + 0452DAD61DEB77D8009EFE32 /* CaptureNotificationObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureNotificationObserver.swift; sourceTree = ""; }; + 0452DAD71DEB77D8009EFE32 /* CGAffineTransform.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGAffineTransform.swift; sourceTree = ""; }; + 0452DAD81DEB77D8009EFE32 /* CGRect.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGRect.swift; sourceTree = ""; }; + 0452DAD91DEB77D8009EFE32 /* CollectionViewChangeObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewChangeObserver.swift; sourceTree = ""; }; + 0452DADA1DEB77D8009EFE32 /* Cropable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cropable.swift; sourceTree = ""; }; + 0452DADB1DEB77D8009EFE32 /* CropableScrollViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropableScrollViewDelegate.swift; sourceTree = ""; }; + 0452DADC1DEB77D8009EFE32 /* FloatingViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FloatingViewLayout.swift; sourceTree = ""; }; + 0452DADD1DEB77D8009EFE32 /* LinesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinesView.swift; sourceTree = ""; }; + 0452DADE1DEB77D8009EFE32 /* NSIndexSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSIndexSet.swift; sourceTree = ""; }; + 0452DADF1DEB77D8009EFE32 /* PhotoCachable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCachable.swift; sourceTree = ""; }; + 0452DAE01DEB77D8009EFE32 /* PhotoCapturable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCapturable.swift; sourceTree = ""; }; + 0452DAE11DEB77D8009EFE32 /* PhotoFetchable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoFetchable.swift; sourceTree = ""; }; + 0452DAE21DEB77D8009EFE32 /* Radians.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Radians.swift; sourceTree = ""; }; + 0452DAE31DEB77D8009EFE32 /* UICollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionView.swift; sourceTree = ""; }; + 0452DAE41DEB77D8009EFE32 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = ""; }; 049AF44D1D38756F0097959B /* HolderViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HolderViewController.swift; sourceTree = ""; }; 049AF44F1D3876050097959B /* CropViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropViewController.swift; sourceTree = ""; }; 049AF4541D387EFC0097959B /* PhotoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCell.swift; sourceTree = ""; }; 049AF4561D387F2F0097959B /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = ""; }; 049AF4581D387F840097959B /* ContainerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerType.swift; sourceTree = ""; }; 049AF45A1D38B8160097959B /* SelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectionViewController.swift; sourceTree = ""; }; - 049AF45C1D38BF670097959B /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -101,7 +105,7 @@ 040D62D01D36A990003F8D8E = { isa = PBXGroup; children = ( - 049AF4381D3875080097959B /* Source */, + 0452DAD41DEB77D8009EFE32 /* Source */, 040D62DB1D36A990003F8D8E /* Athlee-ImagePicker */, 040D62F01D36A991003F8D8E /* Athlee-ImagePickerTests */, 040D62DA1D36A990003F8D8E /* Products */, @@ -202,23 +206,25 @@ name = Support; sourceTree = ""; }; - 049AF4381D3875080097959B /* Source */ = { + 0452DAD41DEB77D8009EFE32 /* Source */ = { isa = PBXGroup; children = ( - 049AF4391D3875080097959B /* CGRect.swift */, - 049AF43A1D3875080097959B /* CollectionViewChangeObserver.swift */, - 049AF43B1D3875080097959B /* Cropable.swift */, - 049AF43C1D3875080097959B /* CropableScrollViewDelegate.swift */, - 049AF43D1D3875080097959B /* FloatingViewLayout.swift */, - 049AF43E1D3875080097959B /* LinesView.swift */, - 049AF43F1D3875080097959B /* NSIndexSet.swift */, - 049AF4401D3875080097959B /* PhotoCachable.swift */, - 049AF4411D3875080097959B /* PhotoFetchable.swift */, - 049AF4421D3875080097959B /* UICollectionView.swift */, - 049AF45C1D38BF670097959B /* UIView.swift */, - 041D01E21D398B1400D2EB81 /* Capturable.swift */, - 041D01E81D39980700D2EB81 /* PhotoCapturable.swift */, - 041D01E41D398F0D00D2EB81 /* CaptureNotificationObserver.swift */, + 0452DAD51DEB77D8009EFE32 /* Capturable.swift */, + 0452DAD61DEB77D8009EFE32 /* CaptureNotificationObserver.swift */, + 0452DAD71DEB77D8009EFE32 /* CGAffineTransform.swift */, + 0452DAD81DEB77D8009EFE32 /* CGRect.swift */, + 0452DAD91DEB77D8009EFE32 /* CollectionViewChangeObserver.swift */, + 0452DADA1DEB77D8009EFE32 /* Cropable.swift */, + 0452DADB1DEB77D8009EFE32 /* CropableScrollViewDelegate.swift */, + 0452DADC1DEB77D8009EFE32 /* FloatingViewLayout.swift */, + 0452DADD1DEB77D8009EFE32 /* LinesView.swift */, + 0452DADE1DEB77D8009EFE32 /* NSIndexSet.swift */, + 0452DADF1DEB77D8009EFE32 /* PhotoCachable.swift */, + 0452DAE01DEB77D8009EFE32 /* PhotoCapturable.swift */, + 0452DAE11DEB77D8009EFE32 /* PhotoFetchable.swift */, + 0452DAE21DEB77D8009EFE32 /* Radians.swift */, + 0452DAE31DEB77D8009EFE32 /* UICollectionView.swift */, + 0452DAE41DEB77D8009EFE32 /* UIView.swift */, ); name = Source; path = ../../Source; @@ -277,7 +283,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0730; + LastUpgradeCheck = 0810; ORGANIZATIONNAME = Athlee; TargetAttributes = { 040D62D81D36A990003F8D8E = { @@ -336,28 +342,30 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 049AF4491D3875080097959B /* NSIndexSet.swift in Sources */, + 0452DAED1DEB77D8009EFE32 /* LinesView.swift in Sources */, + 0452DAEB1DEB77D8009EFE32 /* CropableScrollViewDelegate.swift in Sources */, + 0452DAE81DEB77D8009EFE32 /* CGRect.swift in Sources */, + 0452DAEE1DEB77D8009EFE32 /* NSIndexSet.swift in Sources */, 049AF4551D387EFC0097959B /* PhotoCell.swift in Sources */, - 049AF4481D3875080097959B /* LinesView.swift in Sources */, - 041D01E51D398F0D00D2EB81 /* CaptureNotificationObserver.swift in Sources */, 040D62DF1D36A990003F8D8E /* ImagePickerController.swift in Sources */, - 041D01E91D39980700D2EB81 /* PhotoCapturable.swift in Sources */, - 049AF4431D3875080097959B /* CGRect.swift in Sources */, + 0452DAF31DEB77D8009EFE32 /* UICollectionView.swift in Sources */, 049AF4591D387F840097959B /* ContainerType.swift in Sources */, + 0452DAEF1DEB77D8009EFE32 /* PhotoCachable.swift in Sources */, + 0452DAE61DEB77D8009EFE32 /* CaptureNotificationObserver.swift in Sources */, + 0452DAF11DEB77D8009EFE32 /* PhotoFetchable.swift in Sources */, 041D01E71D39910900D2EB81 /* CaptureViewController.swift in Sources */, - 049AF4471D3875080097959B /* FloatingViewLayout.swift in Sources */, - 049AF4461D3875080097959B /* CropableScrollViewDelegate.swift in Sources */, + 0452DAE51DEB77D8009EFE32 /* Capturable.swift in Sources */, 049AF4501D3876050097959B /* CropViewController.swift in Sources */, - 049AF44C1D3875080097959B /* UICollectionView.swift in Sources */, - 049AF4441D3875080097959B /* CollectionViewChangeObserver.swift in Sources */, - 041D01E31D398B1400D2EB81 /* Capturable.swift in Sources */, - 049AF44A1D3875080097959B /* PhotoCachable.swift in Sources */, - 049AF4451D3875080097959B /* Cropable.swift in Sources */, - 049AF45D1D38BF670097959B /* UIView.swift in Sources */, + 0452DAE91DEB77D8009EFE32 /* CollectionViewChangeObserver.swift in Sources */, 049AF45B1D38B8160097959B /* SelectionViewController.swift in Sources */, + 0452DAF01DEB77D8009EFE32 /* PhotoCapturable.swift in Sources */, 049AF44E1D38756F0097959B /* HolderViewController.swift in Sources */, + 0452DAE71DEB77D8009EFE32 /* CGAffineTransform.swift in Sources */, + 0452DAF21DEB77D8009EFE32 /* Radians.swift in Sources */, + 0452DAF41DEB77D8009EFE32 /* UIView.swift in Sources */, + 0452DAEC1DEB77D8009EFE32 /* FloatingViewLayout.swift in Sources */, 049AF4571D387F2F0097959B /* PhotoViewController.swift in Sources */, - 049AF44B1D3875080097959B /* PhotoFetchable.swift in Sources */, + 0452DAEA1DEB77D8009EFE32 /* Cropable.swift in Sources */, 040D62DD1D36A990003F8D8E /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -414,8 +422,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -459,8 +469,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -479,6 +491,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/Example/Athlee-ImagePicker/Athlee-ImagePicker/CropViewController.swift b/Example/Athlee-ImagePicker/Athlee-ImagePicker/CropViewController.swift index ce20520..333a18e 100644 --- a/Example/Athlee-ImagePicker/Athlee-ImagePicker/CropViewController.swift +++ b/Example/Athlee-ImagePicker/Athlee-ImagePicker/CropViewController.swift @@ -25,6 +25,7 @@ final class CropViewController: UIViewController, FloatingViewLayout, Cropable { // MARK: Cropable properties var cropView = UIScrollView() + var childContainerView = UIView() var childView = UIImageView() var linesView = LinesView() diff --git a/Source/.DS_Store b/Source/.DS_Store index 521771c..87c60b6 100644 Binary files a/Source/.DS_Store and b/Source/.DS_Store differ diff --git a/Source/CGAffineTransform.swift b/Source/CGAffineTransform.swift new file mode 100644 index 0000000..a65b866 --- /dev/null +++ b/Source/CGAffineTransform.swift @@ -0,0 +1,39 @@ +// +// CGAffineTransform.swift +// Pods +// +// Created by mac on 27/11/2016. +// +// + +import UIKit + +public extension CGAffineTransform { + public static func scalingFactor(toFill containerSize: CGSize, with contentSize: CGSize, atAngle angle: Double) -> Double { + var theta = fabs(angle - 2 * .pi * trunc(angle / .pi / 2) - .pi) + + if theta > .pi / 2 { + theta = fabs(.pi - theta) + } + + let h = Double(contentSize.height) + let H = Double(containerSize.height) + let w = Double(contentSize.width) + let W = Double(containerSize.width) + + let scale1 = (H * cos(theta) + W * sin(theta)) / min(H, h) + let scale2 = (H * sin(theta) + W * cos(theta)) / min(W, w) + + let scalingFactor = max(scale1, scale2) + + return scalingFactor + } + + func scaling(toFill containerSize: CGSize, with contentSize: CGSize, atAngle angle: Double) -> CGAffineTransform { + let factor = CGFloat(CGAffineTransform.scalingFactor(toFill: containerSize, + with: contentSize, + atAngle: angle)) + + return self.scaledBy(x: factor, y: factor) + } +} diff --git a/Source/Cropable.swift b/Source/Cropable.swift index b0e2445..37db875 100644 --- a/Source/Cropable.swift +++ b/Source/Cropable.swift @@ -18,6 +18,10 @@ public protocol Cropable { /// A cropable area containing the content. var cropView: UIScrollView { get set } + /// A view containing the child. It is required to simplify + /// any transformations on the child. + var childContainerView: UIView { get set } + /// A cropable content view. var childView: ChildView { get set } @@ -125,7 +129,8 @@ public extension Cropable where ChildView == UIImageView { cropView.showsVerticalScrollIndicator = false cropView.contentSize = view.bounds.size - cropView.addSubview(childView) + childContainerView.addSubview(childView) + cropView.addSubview(childContainerView) } /// @@ -150,10 +155,14 @@ public extension Cropable where ChildView == UIImageView { childView.image = image if adjustingContent { - childView.sizeToFit() + childView.bounds.size = image.size + childContainerView.bounds.size = image.size + + childContainerView.frame.origin = .zero childView.frame.origin = .zero + cropView.contentOffset = .zero - cropView.contentSize = childView.image!.size + cropView.contentSize = image.size updateContent() highlightArea(false, animated: false) @@ -185,8 +194,9 @@ public extension Cropable { /// Updates the current cropable content area, zoom and scale. /// func updateContent() { - let childViewSize = childView.bounds.size + let childViewSize = childContainerView.bounds.size let scrollViewSize = cropView.bounds.size + let widthScale = scrollViewSize.width / childViewSize.width let heightScale = scrollViewSize.height / childViewSize.height @@ -215,16 +225,16 @@ public extension Cropable { func centerContent(forcing: Bool = false) { var (left, top): (CGFloat, CGFloat) = (0, 0) - if cropView.contentSize.width < cropView.bounds.width { - left = (cropView.bounds.width - cropView.contentSize.width) / 2 + if cropView.contentSize.width < cropView.frame.width { + left = (cropView.frame.width - cropView.contentSize.width) / 2 } else if forcing { - cropView.contentOffset.x = abs(cropView.bounds.width - cropView.contentSize.width) / 2 + cropView.contentOffset.x = abs(cropView.frame.width - cropView.contentSize.width) / 2 } - if cropView.contentSize.height < cropView.bounds.height { - top = (cropView.bounds.height - cropView.contentSize.height) / 2 + if cropView.contentSize.height < cropView.frame.height { + top = (cropView.frame.height - cropView.contentSize.height) / 2 } else if forcing { - cropView.contentOffset.y = abs(cropView.bounds.height - cropView.contentSize.height) / 2 + cropView.contentOffset.y = abs(cropView.frame.height - cropView.contentSize.height) / 2 } cropView.contentInset = UIEdgeInsets(top: top, left: left, bottom: top, right: left) @@ -302,12 +312,12 @@ public extension Cropable { } linesView.frame.size = CGSize( - width: min(cropView.frame.width, childView.frame.width), - height: min(cropView.frame.height, childView.frame.height) + width: min(cropView.frame.width, childContainerView.frame.width), + height: min(cropView.frame.height, childContainerView.frame.height) ) let visibleRect = CGRect(origin: cropView.contentOffset, size: cropView.bounds.size) - let intersection = visibleRect.intersection(childView.frame) + let intersection = visibleRect.intersection(childContainerView.frame) linesView.frame = intersection } } diff --git a/Source/CropableScrollViewDelegate.swift b/Source/CropableScrollViewDelegate.swift index cefaccf..0be9a89 100644 --- a/Source/CropableScrollViewDelegate.swift +++ b/Source/CropableScrollViewDelegate.swift @@ -91,6 +91,6 @@ open class CropableScrollViewDelegate: NSObject, UIScrollViewDelega } open func viewForZooming(in scrollView: UIScrollView) -> UIView? { - return cropable.childView + return cropable.childContainerView } } diff --git a/Source/Radians.swift b/Source/Radians.swift new file mode 100644 index 0000000..4d823f0 --- /dev/null +++ b/Source/Radians.swift @@ -0,0 +1,21 @@ +// +// Radians.swift +// Pods +// +// Created by mac on 27/11/2016. +// +// + +import Foundation + +public extension Double { + public func toRadians() -> Double { + return self * .pi / 180.0 + } +} + +public extension Float { + public func toRadians() -> Float { + return self * .pi / 180 + } +}