diff --git a/.gitignore b/.gitignore index d534044..91b1ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,7 @@ playground.xcworkspace # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # -# Pods/ +Pods/ # Carthage # diff --git a/AssetsPicker.xcodeproj/project.pbxproj b/AssetsPicker.xcodeproj/project.pbxproj new file mode 100644 index 0000000..4d180fe --- /dev/null +++ b/AssetsPicker.xcodeproj/project.pbxproj @@ -0,0 +1,677 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + E94855AC22F3D3300018A55A /* AssetsPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = E94855AA22F3D3300018A55A /* AssetsPicker.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E94855FB22F3D4020018A55A /* AssetsPickerCustomStringConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855B822F3D4020018A55A /* AssetsPickerCustomStringConfig.swift */; }; + E94855FC22F3D4020018A55A /* AssetsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855BA22F3D4020018A55A /* AssetsPickerViewController.swift */; }; + E94855FD22F3D4020018A55A /* SSCheckMark.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855BC22F3D4020018A55A /* SSCheckMark.swift */; }; + E94855FE22F3D4020018A55A /* AssetsGuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855BD22F3D4020018A55A /* AssetsGuideView.swift */; }; + E94855FF22F3D4020018A55A /* AssetsPickerConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855BE22F3D4020018A55A /* AssetsPickerConfig.swift */; }; + E948560122F3D4020018A55A /* AssetsCropViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855C222F3D4020018A55A /* AssetsCropViewController.swift */; }; + E948560222F3D4020018A55A /* UIColor+ARGB.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855C522F3D4020018A55A /* UIColor+ARGB.swift */; }; + E948560322F3D4020018A55A /* UIView+Dimmer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855C622F3D4020018A55A /* UIView+Dimmer.swift */; }; + E948560422F3D4020018A55A /* UIView+KVO.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855C722F3D4020018A55A /* UIView+KVO.swift */; }; + E948560522F3D4020018A55A /* UIView+Fade.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855C822F3D4020018A55A /* UIView+Fade.swift */; }; + E948560622F3D4020018A55A /* TinyLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855CA22F3D4020018A55A /* TinyLog.swift */; }; + E948560722F3D4020018A55A /* AssetsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855CC22F3D4020018A55A /* AssetsManager.swift */; }; + E948560822F3D4020018A55A /* AssetsManager+Sync.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855CD22F3D4020018A55A /* AssetsManager+Sync.swift */; }; + E948560922F3D4020018A55A /* AssetsUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855CE22F3D4020018A55A /* AssetsUtility.swift */; }; + E948560A22F3D4020018A55A /* AssetsAlbumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855D122F3D4020018A55A /* AssetsAlbumViewController.swift */; }; + E948560B22F3D4020018A55A /* AssetsAlbumLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855D322F3D4020018A55A /* AssetsAlbumLayout.swift */; }; + E948560C22F3D4020018A55A /* AssetsAlbumHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855D422F3D4020018A55A /* AssetsAlbumHeaderView.swift */; }; + E948560D22F3D4020018A55A /* AssetsAlbumCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855D522F3D4020018A55A /* AssetsAlbumCell.swift */; }; + E948560E22F3D4020018A55A /* AssetsAlbumTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855D622F3D4020018A55A /* AssetsAlbumTitleView.swift */; }; + E948560F22F3D4020018A55A /* AssetsPreviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855D922F3D4020018A55A /* AssetsPreviewController.swift */; }; + E948561022F3D4020018A55A /* AssetsPhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855DA22F3D4020018A55A /* AssetsPhotoViewController.swift */; }; + E948561122F3D4020018A55A /* PanoramaIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855DC22F3D4020018A55A /* PanoramaIconView.swift */; }; + E948561222F3D4020018A55A /* AssetsNoPermissionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855DD22F3D4020018A55A /* AssetsNoPermissionView.swift */; }; + E948561322F3D4020018A55A /* AssetsPhotoLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855DE22F3D4020018A55A /* AssetsPhotoLayout.swift */; }; + E948561422F3D4020018A55A /* AssetsPhotoCellOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855DF22F3D4020018A55A /* AssetsPhotoCellOverlay.swift */; }; + E948561522F3D4020018A55A /* AssetsPhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E022F3D4020018A55A /* AssetsPhotoCell.swift */; }; + E948561622F3D4020018A55A /* AssetsFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E122F3D4020018A55A /* AssetsFooterView.swift */; }; + E948561722F3D4020018A55A /* AssetsEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E222F3D4020018A55A /* AssetsEmptyView.swift */; }; + E948561822F3D4020018A55A /* NumberFormatter+AssetsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E422F3D4020018A55A /* NumberFormatter+AssetsPickerViewController.swift */; }; + E948561922F3D4020018A55A /* UIScreen+AssetsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E522F3D4020018A55A /* UIScreen+AssetsPickerViewController.swift */; }; + E948561A22F3D4020018A55A /* UIFont+AssetsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E622F3D4020018A55A /* UIFont+AssetsPickerViewController.swift */; }; + E948561B22F3D4020018A55A /* String+AssetsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E722F3D4020018A55A /* String+AssetsPickerViewController.swift */; }; + E948561C22F3D4020018A55A /* Bundle+AssetsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E822F3D4020018A55A /* Bundle+AssetsPickerViewController.swift */; }; + E948561D22F3D4020018A55A /* Device+AssetsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94855E922F3D4020018A55A /* Device+AssetsPickerViewController.swift */; }; + E948561E22F3D4020018A55A /* AssetsPickerViewController.strings in Resources */ = {isa = PBXBuildFile; fileRef = E94855EB22F3D4020018A55A /* AssetsPickerViewController.strings */; }; + E99FB03A22F4023400B15CC9 /* UIView+Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = E99FB03922F4023400B15CC9 /* UIView+Layout.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E94855A722F3D3300018A55A /* AssetsPicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AssetsPicker.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E94855AA22F3D3300018A55A /* AssetsPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AssetsPicker.h; sourceTree = ""; }; + E94855AB22F3D3300018A55A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E94855B822F3D4020018A55A /* AssetsPickerCustomStringConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPickerCustomStringConfig.swift; sourceTree = ""; }; + E94855BA22F3D4020018A55A /* AssetsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPickerViewController.swift; sourceTree = ""; }; + E94855BC22F3D4020018A55A /* SSCheckMark.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SSCheckMark.swift; sourceTree = ""; }; + E94855BD22F3D4020018A55A /* AssetsGuideView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsGuideView.swift; sourceTree = ""; }; + E94855BE22F3D4020018A55A /* AssetsPickerConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPickerConfig.swift; sourceTree = ""; }; + E94855C222F3D4020018A55A /* AssetsCropViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsCropViewController.swift; sourceTree = ""; }; + E94855C522F3D4020018A55A /* UIColor+ARGB.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+ARGB.swift"; sourceTree = ""; }; + E94855C622F3D4020018A55A /* UIView+Dimmer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Dimmer.swift"; sourceTree = ""; }; + E94855C722F3D4020018A55A /* UIView+KVO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+KVO.swift"; sourceTree = ""; }; + E94855C822F3D4020018A55A /* UIView+Fade.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Fade.swift"; sourceTree = ""; }; + E94855CA22F3D4020018A55A /* TinyLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TinyLog.swift; sourceTree = ""; }; + E94855CC22F3D4020018A55A /* AssetsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsManager.swift; sourceTree = ""; }; + E94855CD22F3D4020018A55A /* AssetsManager+Sync.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AssetsManager+Sync.swift"; sourceTree = ""; }; + E94855CE22F3D4020018A55A /* AssetsUtility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsUtility.swift; sourceTree = ""; }; + E94855D122F3D4020018A55A /* AssetsAlbumViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsAlbumViewController.swift; sourceTree = ""; }; + E94855D322F3D4020018A55A /* AssetsAlbumLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsAlbumLayout.swift; sourceTree = ""; }; + E94855D422F3D4020018A55A /* AssetsAlbumHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsAlbumHeaderView.swift; sourceTree = ""; }; + E94855D522F3D4020018A55A /* AssetsAlbumCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsAlbumCell.swift; sourceTree = ""; }; + E94855D622F3D4020018A55A /* AssetsAlbumTitleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsAlbumTitleView.swift; sourceTree = ""; }; + E94855D922F3D4020018A55A /* AssetsPreviewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPreviewController.swift; sourceTree = ""; }; + E94855DA22F3D4020018A55A /* AssetsPhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPhotoViewController.swift; sourceTree = ""; }; + E94855DC22F3D4020018A55A /* PanoramaIconView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PanoramaIconView.swift; sourceTree = ""; }; + E94855DD22F3D4020018A55A /* AssetsNoPermissionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsNoPermissionView.swift; sourceTree = ""; }; + E94855DE22F3D4020018A55A /* AssetsPhotoLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPhotoLayout.swift; sourceTree = ""; }; + E94855DF22F3D4020018A55A /* AssetsPhotoCellOverlay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPhotoCellOverlay.swift; sourceTree = ""; }; + E94855E022F3D4020018A55A /* AssetsPhotoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsPhotoCell.swift; sourceTree = ""; }; + E94855E122F3D4020018A55A /* AssetsFooterView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsFooterView.swift; sourceTree = ""; }; + E94855E222F3D4020018A55A /* AssetsEmptyView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsEmptyView.swift; sourceTree = ""; }; + E94855E422F3D4020018A55A /* NumberFormatter+AssetsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NumberFormatter+AssetsPickerViewController.swift"; sourceTree = ""; }; + E94855E522F3D4020018A55A /* UIScreen+AssetsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIScreen+AssetsPickerViewController.swift"; sourceTree = ""; }; + E94855E622F3D4020018A55A /* UIFont+AssetsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIFont+AssetsPickerViewController.swift"; sourceTree = ""; }; + E94855E722F3D4020018A55A /* String+AssetsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+AssetsPickerViewController.swift"; sourceTree = ""; }; + E94855E822F3D4020018A55A /* Bundle+AssetsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Bundle+AssetsPickerViewController.swift"; sourceTree = ""; }; + E94855E922F3D4020018A55A /* Device+AssetsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Device+AssetsPickerViewController.swift"; sourceTree = ""; }; + E94855EC22F3D4020018A55A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855ED22F3D4020018A55A /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855EE22F3D4020018A55A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/AssetsPickerViewController.strings"; sourceTree = ""; }; + E94855EF22F3D4020018A55A /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855F022F3D4020018A55A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855F122F3D4020018A55A /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855F322F3D4020018A55A /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855F422F3D4020018A55A /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/AssetsPickerViewController.strings"; sourceTree = ""; }; + E94855F522F3D4020018A55A /* hi-IN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "hi-IN"; path = "hi-IN.lproj/AssetsPickerViewController.strings"; sourceTree = ""; }; + E94855F622F3D4020018A55A /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855F722F3D4020018A55A /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/AssetsPickerViewController.strings"; sourceTree = ""; }; + E94855F822F3D4020018A55A /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855F922F3D4020018A55A /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E94855FA22F3D4020018A55A /* id */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = id; path = id.lproj/AssetsPickerViewController.strings; sourceTree = ""; }; + E99FB03922F4023400B15CC9 /* UIView+Layout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Layout.swift"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E94855A422F3D3300018A55A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E948559D22F3D3300018A55A = { + isa = PBXGroup; + children = ( + E94855A922F3D3300018A55A /* AssetsPicker */, + E94855A822F3D3300018A55A /* Products */, + ); + sourceTree = ""; + }; + E94855A822F3D3300018A55A /* Products */ = { + isa = PBXGroup; + children = ( + E94855A722F3D3300018A55A /* AssetsPicker.framework */, + ); + name = Products; + sourceTree = ""; + }; + E94855A922F3D3300018A55A /* AssetsPicker */ = { + isa = PBXGroup; + children = ( + E94855EA22F3D4020018A55A /* Assets */, + E94855B622F3D4020018A55A /* Classes */, + E94855AA22F3D3300018A55A /* AssetsPicker.h */, + E94855AB22F3D3300018A55A /* Info.plist */, + ); + name = AssetsPicker; + path = AssetsPickerViewController; + sourceTree = ""; + }; + E94855B622F3D4020018A55A /* Classes */ = { + isa = PBXGroup; + children = ( + E94855B722F3D4020018A55A /* Picker */, + E94855C022F3D4020018A55A /* Crop */, + E94855C322F3D4020018A55A /* Library */, + E94855CB22F3D4020018A55A /* Assets */, + E94855CF22F3D4020018A55A /* Album */, + E94855D722F3D4020018A55A /* Photo */, + E94855E322F3D4020018A55A /* Utility */, + ); + path = Classes; + sourceTree = ""; + }; + E94855B722F3D4020018A55A /* Picker */ = { + isa = PBXGroup; + children = ( + E94855B822F3D4020018A55A /* AssetsPickerCustomStringConfig.swift */, + E94855B922F3D4020018A55A /* Controller */, + E94855BB22F3D4020018A55A /* View */, + E94855BE22F3D4020018A55A /* AssetsPickerConfig.swift */, + ); + path = Picker; + sourceTree = ""; + }; + E94855B922F3D4020018A55A /* Controller */ = { + isa = PBXGroup; + children = ( + E94855BA22F3D4020018A55A /* AssetsPickerViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + E94855BB22F3D4020018A55A /* View */ = { + isa = PBXGroup; + children = ( + E94855BC22F3D4020018A55A /* SSCheckMark.swift */, + E94855BD22F3D4020018A55A /* AssetsGuideView.swift */, + ); + path = View; + sourceTree = ""; + }; + E94855C022F3D4020018A55A /* Crop */ = { + isa = PBXGroup; + children = ( + E94855C122F3D4020018A55A /* Controller */, + ); + path = Crop; + sourceTree = ""; + }; + E94855C122F3D4020018A55A /* Controller */ = { + isa = PBXGroup; + children = ( + E94855C222F3D4020018A55A /* AssetsCropViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + E94855C322F3D4020018A55A /* Library */ = { + isa = PBXGroup; + children = ( + E94855C422F3D4020018A55A /* Extensions */, + E94855C922F3D4020018A55A /* TinyLog */, + ); + path = Library; + sourceTree = ""; + }; + E94855C422F3D4020018A55A /* Extensions */ = { + isa = PBXGroup; + children = ( + E94855C522F3D4020018A55A /* UIColor+ARGB.swift */, + E94855C622F3D4020018A55A /* UIView+Dimmer.swift */, + E94855C722F3D4020018A55A /* UIView+KVO.swift */, + E94855C822F3D4020018A55A /* UIView+Fade.swift */, + E99FB03922F4023400B15CC9 /* UIView+Layout.swift */, + ); + path = Extensions; + sourceTree = ""; + }; + E94855C922F3D4020018A55A /* TinyLog */ = { + isa = PBXGroup; + children = ( + E94855CA22F3D4020018A55A /* TinyLog.swift */, + ); + path = TinyLog; + sourceTree = ""; + }; + E94855CB22F3D4020018A55A /* Assets */ = { + isa = PBXGroup; + children = ( + E94855CC22F3D4020018A55A /* AssetsManager.swift */, + E94855CD22F3D4020018A55A /* AssetsManager+Sync.swift */, + E94855CE22F3D4020018A55A /* AssetsUtility.swift */, + ); + path = Assets; + sourceTree = ""; + }; + E94855CF22F3D4020018A55A /* Album */ = { + isa = PBXGroup; + children = ( + E94855D022F3D4020018A55A /* Controller */, + E94855D222F3D4020018A55A /* View */, + ); + path = Album; + sourceTree = ""; + }; + E94855D022F3D4020018A55A /* Controller */ = { + isa = PBXGroup; + children = ( + E94855D122F3D4020018A55A /* AssetsAlbumViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + E94855D222F3D4020018A55A /* View */ = { + isa = PBXGroup; + children = ( + E94855D322F3D4020018A55A /* AssetsAlbumLayout.swift */, + E94855D422F3D4020018A55A /* AssetsAlbumHeaderView.swift */, + E94855D522F3D4020018A55A /* AssetsAlbumCell.swift */, + E94855D622F3D4020018A55A /* AssetsAlbumTitleView.swift */, + ); + path = View; + sourceTree = ""; + }; + E94855D722F3D4020018A55A /* Photo */ = { + isa = PBXGroup; + children = ( + E94855D822F3D4020018A55A /* Controller */, + E94855DB22F3D4020018A55A /* View */, + ); + path = Photo; + sourceTree = ""; + }; + E94855D822F3D4020018A55A /* Controller */ = { + isa = PBXGroup; + children = ( + E94855D922F3D4020018A55A /* AssetsPreviewController.swift */, + E94855DA22F3D4020018A55A /* AssetsPhotoViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + E94855DB22F3D4020018A55A /* View */ = { + isa = PBXGroup; + children = ( + E94855DC22F3D4020018A55A /* PanoramaIconView.swift */, + E94855DD22F3D4020018A55A /* AssetsNoPermissionView.swift */, + E94855DE22F3D4020018A55A /* AssetsPhotoLayout.swift */, + E94855DF22F3D4020018A55A /* AssetsPhotoCellOverlay.swift */, + E94855E022F3D4020018A55A /* AssetsPhotoCell.swift */, + E94855E122F3D4020018A55A /* AssetsFooterView.swift */, + E94855E222F3D4020018A55A /* AssetsEmptyView.swift */, + ); + path = View; + sourceTree = ""; + }; + E94855E322F3D4020018A55A /* Utility */ = { + isa = PBXGroup; + children = ( + E94855E422F3D4020018A55A /* NumberFormatter+AssetsPickerViewController.swift */, + E94855E522F3D4020018A55A /* UIScreen+AssetsPickerViewController.swift */, + E94855E622F3D4020018A55A /* UIFont+AssetsPickerViewController.swift */, + E94855E722F3D4020018A55A /* String+AssetsPickerViewController.swift */, + E94855E822F3D4020018A55A /* Bundle+AssetsPickerViewController.swift */, + E94855E922F3D4020018A55A /* Device+AssetsPickerViewController.swift */, + ); + path = Utility; + sourceTree = ""; + }; + E94855EA22F3D4020018A55A /* Assets */ = { + isa = PBXGroup; + children = ( + E94855EB22F3D4020018A55A /* AssetsPickerViewController.strings */, + ); + path = Assets; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + E94855A222F3D3300018A55A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + E94855AC22F3D3300018A55A /* AssetsPicker.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + E94855A622F3D3300018A55A /* AssetsPicker */ = { + isa = PBXNativeTarget; + buildConfigurationList = E94855AF22F3D3300018A55A /* Build configuration list for PBXNativeTarget "AssetsPicker" */; + buildPhases = ( + E94855A222F3D3300018A55A /* Headers */, + E94855A322F3D3300018A55A /* Sources */, + E94855A422F3D3300018A55A /* Frameworks */, + E94855A522F3D3300018A55A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AssetsPicker; + productName = AssetsPicker; + productReference = E94855A722F3D3300018A55A /* AssetsPicker.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E948559E22F3D3300018A55A /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1330; + TargetAttributes = { + E94855A622F3D3300018A55A = { + CreatedOnToolsVersion = 10.3; + }; + }; + }; + buildConfigurationList = E94855A122F3D3300018A55A /* Build configuration list for PBXProject "AssetsPicker" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + de, + ar, + "zh-Hans", + ja, + es, + ko, + "zh-Hant", + "hi-IN", + tr, + "es-MX", + ru, + fr, + id, + ); + mainGroup = E948559D22F3D3300018A55A; + productRefGroup = E94855A822F3D3300018A55A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E94855A622F3D3300018A55A /* AssetsPicker */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E94855A522F3D3300018A55A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E948561E22F3D4020018A55A /* AssetsPickerViewController.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E94855A322F3D3300018A55A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E948560822F3D4020018A55A /* AssetsManager+Sync.swift in Sources */, + E948561022F3D4020018A55A /* AssetsPhotoViewController.swift in Sources */, + E948560622F3D4020018A55A /* TinyLog.swift in Sources */, + E948560322F3D4020018A55A /* UIView+Dimmer.swift in Sources */, + E948560C22F3D4020018A55A /* AssetsAlbumHeaderView.swift in Sources */, + E948561722F3D4020018A55A /* AssetsEmptyView.swift in Sources */, + E94855FE22F3D4020018A55A /* AssetsGuideView.swift in Sources */, + E948561A22F3D4020018A55A /* UIFont+AssetsPickerViewController.swift in Sources */, + E948560B22F3D4020018A55A /* AssetsAlbumLayout.swift in Sources */, + E948561D22F3D4020018A55A /* Device+AssetsPickerViewController.swift in Sources */, + E948561222F3D4020018A55A /* AssetsNoPermissionView.swift in Sources */, + E948560422F3D4020018A55A /* UIView+KVO.swift in Sources */, + E948560122F3D4020018A55A /* AssetsCropViewController.swift in Sources */, + E94855FF22F3D4020018A55A /* AssetsPickerConfig.swift in Sources */, + E948561C22F3D4020018A55A /* Bundle+AssetsPickerViewController.swift in Sources */, + E948561622F3D4020018A55A /* AssetsFooterView.swift in Sources */, + E948560F22F3D4020018A55A /* AssetsPreviewController.swift in Sources */, + E948560222F3D4020018A55A /* UIColor+ARGB.swift in Sources */, + E94855FC22F3D4020018A55A /* AssetsPickerViewController.swift in Sources */, + E99FB03A22F4023400B15CC9 /* UIView+Layout.swift in Sources */, + E948560722F3D4020018A55A /* AssetsManager.swift in Sources */, + E948561122F3D4020018A55A /* PanoramaIconView.swift in Sources */, + E948561822F3D4020018A55A /* NumberFormatter+AssetsPickerViewController.swift in Sources */, + E948561B22F3D4020018A55A /* String+AssetsPickerViewController.swift in Sources */, + E948561922F3D4020018A55A /* UIScreen+AssetsPickerViewController.swift in Sources */, + E948560D22F3D4020018A55A /* AssetsAlbumCell.swift in Sources */, + E948561422F3D4020018A55A /* AssetsPhotoCellOverlay.swift in Sources */, + E94855FB22F3D4020018A55A /* AssetsPickerCustomStringConfig.swift in Sources */, + E948560922F3D4020018A55A /* AssetsUtility.swift in Sources */, + E948560522F3D4020018A55A /* UIView+Fade.swift in Sources */, + E948561522F3D4020018A55A /* AssetsPhotoCell.swift in Sources */, + E94855FD22F3D4020018A55A /* SSCheckMark.swift in Sources */, + E948561322F3D4020018A55A /* AssetsPhotoLayout.swift in Sources */, + E948560E22F3D4020018A55A /* AssetsAlbumTitleView.swift in Sources */, + E948560A22F3D4020018A55A /* AssetsAlbumViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + E94855EB22F3D4020018A55A /* AssetsPickerViewController.strings */ = { + isa = PBXVariantGroup; + children = ( + E94855EC22F3D4020018A55A /* de */, + E94855ED22F3D4020018A55A /* ar */, + E94855EE22F3D4020018A55A /* zh-Hans */, + E94855EF22F3D4020018A55A /* ja */, + E94855F022F3D4020018A55A /* en */, + E94855F122F3D4020018A55A /* es */, + E94855F322F3D4020018A55A /* ko */, + E94855F422F3D4020018A55A /* zh-Hant */, + E94855F522F3D4020018A55A /* hi-IN */, + E94855F622F3D4020018A55A /* tr */, + E94855F722F3D4020018A55A /* es-MX */, + E94855F822F3D4020018A55A /* ru */, + E94855F922F3D4020018A55A /* fr */, + E94855FA22F3D4020018A55A /* id */, + ); + name = AssetsPickerViewController.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + E94855AD22F3D3300018A55A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + E94855AE22F3D3300018A55A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + E94855B022F3D3300018A55A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/AssetsPickerViewController/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.DragonCherry.AssetsPicker; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + E94855B122F3D3300018A55A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/AssetsPickerViewController/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.DragonCherry.AssetsPicker; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E94855A122F3D3300018A55A /* Build configuration list for PBXProject "AssetsPicker" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E94855AD22F3D3300018A55A /* Debug */, + E94855AE22F3D3300018A55A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E94855AF22F3D3300018A55A /* Build configuration list for PBXNativeTarget "AssetsPicker" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E94855B022F3D3300018A55A /* Debug */, + E94855B122F3D3300018A55A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E948559E22F3D3300018A55A /* Project object */; +} diff --git a/AssetsPicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/AssetsPicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..293b671 --- /dev/null +++ b/AssetsPicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/AssetsPicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/AssetsPicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/AssetsPicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/AssetsPicker.xcodeproj/xcshareddata/xcschemes/AssetsPicker.xcscheme b/AssetsPicker.xcodeproj/xcshareddata/xcschemes/AssetsPicker.xcscheme new file mode 100644 index 0000000..f8e6b29 --- /dev/null +++ b/AssetsPicker.xcodeproj/xcshareddata/xcschemes/AssetsPicker.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AssetsPickerViewController.podspec b/AssetsPickerViewController.podspec index 28af998..216d75b 100644 --- a/AssetsPickerViewController.podspec +++ b/AssetsPickerViewController.podspec @@ -36,9 +36,4 @@ Fully customizable UI. s.resource_bundles = { 'AssetsPickerViewController' => ['AssetsPickerViewController/Assets/*.*'] } - - # s.public_header_files = 'Pod/Classes/**/*.h' - # s.frameworks = 'UIKit', 'MapKit' - s.dependency 'SnapKit' - s.dependency 'Device' end diff --git a/AssetsPickerViewController/AssetsPicker.h b/AssetsPickerViewController/AssetsPicker.h new file mode 100644 index 0000000..cda1b07 --- /dev/null +++ b/AssetsPickerViewController/AssetsPicker.h @@ -0,0 +1,18 @@ +// +// AssetsPicker.h +// AssetsPicker +// +// Created by Junfeng Hu on 2/8/19. +// + +#import + +//! Project version number for AssetsPicker. +FOUNDATION_EXPORT double AssetsPickerVersionNumber; + +//! Project version string for AssetsPicker. +FOUNDATION_EXPORT const unsigned char AssetsPickerVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/AssetsPickerViewController/Classes/Album/Controller/AssetsAlbumViewController.swift b/AssetsPickerViewController/Classes/Album/Controller/AssetsAlbumViewController.swift index d37991b..01fe3f1 100644 --- a/AssetsPickerViewController/Classes/Album/Controller/AssetsAlbumViewController.swift +++ b/AssetsPickerViewController/Classes/Album/Controller/AssetsAlbumViewController.swift @@ -94,9 +94,7 @@ open class AssetsAlbumViewController: UIViewController { setupCommon() setupBarButtonItems() - collectionView.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } + collectionView.fillToSuperview() AssetsManager.shared.authorize(completion: { [weak self] isAuthorized in if isAuthorized { diff --git a/AssetsPickerViewController/Classes/Album/View/AssetsAlbumCell.swift b/AssetsPickerViewController/Classes/Album/View/AssetsAlbumCell.swift index 1d9499d..c844539 100644 --- a/AssetsPickerViewController/Classes/Album/View/AssetsAlbumCell.swift +++ b/AssetsPickerViewController/Classes/Album/View/AssetsAlbumCell.swift @@ -90,25 +90,25 @@ open class AssetsAlbumCell: UICollectionViewCell, AssetsAlbumCellProtocol { contentView.addSubview(titleLabel) contentView.addSubview(countLabel) - imageView.snp.makeConstraints { (make) in - make.height.equalTo(imageView.snp.width) - make.top.equalToSuperview() - make.leading.equalToSuperview() - make.trailing.equalToSuperview() - } - - titleLabel.snp.makeConstraints { (make) in - make.top.equalTo(imageView.snp.bottom).offset(8) - make.leading.equalToSuperview() - make.trailing.equalToSuperview() - make.height.equalTo(titleLabel.font.pointSize + 2) - } + imageView.anchor( + top: contentView.topAnchor, + leading: contentView.leadingAnchor, + trailing: contentView.trailingAnchor + ) + imageView.heightAnchor.constraint(equalTo: imageView.widthAnchor).isActive = true - countLabel.snp.makeConstraints { (make) in - make.top.equalTo(titleLabel.snp.bottom).offset(2) - make.leading.equalToSuperview() - make.trailing.equalToSuperview() - make.height.equalTo(countLabel.font.pointSize + 2) - } + titleLabel.anchor( + leading: contentView.leadingAnchor, + trailing: contentView.trailingAnchor, + heightConstant: titleLabel.font.pointSize + 2 + ) + titleLabel.topAnchor.constraint(equalTo: imageView.bottomAnchor, constant: 8).isActive = true + + countLabel.anchor( + leading: contentView.leadingAnchor, + trailing: contentView.trailingAnchor, + heightConstant: countLabel.font.pointSize + 2 + ) + countLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 2).isActive = true } } diff --git a/AssetsPickerViewController/Classes/Album/View/AssetsAlbumHeaderView.swift b/AssetsPickerViewController/Classes/Album/View/AssetsAlbumHeaderView.swift index 758e1c8..e7bf9a6 100644 --- a/AssetsPickerViewController/Classes/Album/View/AssetsAlbumHeaderView.swift +++ b/AssetsPickerViewController/Classes/Album/View/AssetsAlbumHeaderView.swift @@ -30,8 +30,6 @@ open class AssetsAlbumHeaderView: UICollectionReusableView { private func commonInit() { addSubview(titleLabel) - titleLabel.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } + titleLabel.fillToSuperview() } } diff --git a/AssetsPickerViewController/Classes/Assets/AssetsManager+Sync.swift b/AssetsPickerViewController/Classes/Assets/AssetsManager+Sync.swift index 02a489e..117256a 100644 --- a/AssetsPickerViewController/Classes/Assets/AssetsManager+Sync.swift +++ b/AssetsPickerViewController/Classes/Assets/AssetsManager+Sync.swift @@ -11,7 +11,7 @@ import Photos // MARK: - PHPhotoLibraryChangeObserver & Sync extension AssetsManager: PHPhotoLibraryChangeObserver { - func synchronizeAlbums(changeInstance: PHChange) -> [IndexSet] { + private func synchronizeAlbums(changeInstance: PHChange) -> [IndexSet] { // updated index set var updatedIndexSets = [IndexSet]() @@ -24,6 +24,7 @@ extension AssetsManager: PHPhotoLibraryChangeObserver { guard let albumsChangeDetail = changeInstance.changeDetails(for: albumsFetchResult) else { continue } + guard albumsFetchArray.count > section else { continue } // update albumsFetchArray albumsFetchArray[section] = albumsChangeDetail.fetchResultAfterChanges @@ -58,9 +59,9 @@ extension AssetsManager: PHPhotoLibraryChangeObserver { return updatedIndexSets } - func synchronizeAssets(updatedAlbumIndexSets: [IndexSet], fetchMapBeforeChanges: [String: PHFetchResult], changeInstance: PHChange) { + private func synchronizeAssets(updatedAlbumIndexSets: [IndexSet], fetchMapBeforeChanges: [String: PHFetchResult], changeInstance: PHChange) { - var updatedIndexSets = updatedAlbumIndexSets + let updatedIndexSets = updatedAlbumIndexSets // notify changes of assets for (section, albums) in fetchedAlbumsArray.enumerated() { @@ -191,13 +192,16 @@ extension AssetsManager: PHPhotoLibraryChangeObserver { logw("Does not have access to photo library.") return } - let fetchMapBeforeChanges = fetchMap - let updatedAlbumIndexSets = synchronizeAlbums(changeInstance: changeInstance) - synchronizeAssets( - updatedAlbumIndexSets: updatedAlbumIndexSets, - fetchMapBeforeChanges: fetchMapBeforeChanges, - changeInstance: changeInstance - ) + DispatchQueue.main.async { [weak self] in + guard let self = self else { return } + let fetchMapBeforeChanges = self.fetchMap + let updatedAlbumIndexSets = self.synchronizeAlbums(changeInstance: changeInstance) + self.synchronizeAssets( + updatedAlbumIndexSets: updatedAlbumIndexSets, + fetchMapBeforeChanges: fetchMapBeforeChanges, + changeInstance: changeInstance + ) + } } public func removedIndexPaths(from newAlbums: [PHAssetCollection], oldAlbums: [PHAssetCollection], section: Int) -> (indexPaths: [IndexPath], albums: [PHAssetCollection]) { diff --git a/AssetsPickerViewController/Classes/Assets/AssetsManager.swift b/AssetsPickerViewController/Classes/Assets/AssetsManager.swift index 17c7585..cfec606 100644 --- a/AssetsPickerViewController/Classes/Assets/AssetsManager.swift +++ b/AssetsPickerViewController/Classes/Assets/AssetsManager.swift @@ -10,7 +10,7 @@ import UIKit import Photos // MARK: - AssetsManagerDelegate -public protocol AssetsManagerDelegate: class { +public protocol AssetsManagerDelegate: AnyObject { func assetsManager(manager: AssetsManager, authorizationStatusChanged oldStatus: PHAuthorizationStatus, newStatus: PHAuthorizationStatus) func assetsManager(manager: AssetsManager, reloadedAlbumsInSection section: Int) @@ -52,7 +52,7 @@ open class AssetsManager: NSObject { internal(set) open var assetArray = [PHAsset]() fileprivate(set) open var defaultAlbum: PHAssetCollection? - fileprivate(set) open var cameraRollAlbum: PHAssetCollection! + fileprivate(set) open var cameraRollAlbum: PHAssetCollection? fileprivate(set) open var selectedAlbum: PHAssetCollection? fileprivate var isFetchedAlbums: Bool = false @@ -113,10 +113,8 @@ extension AssetsManager { open func notifySubscribers(_ action: @escaping ((AssetsManagerDelegate) -> Void), condition: Bool = true) { if condition { - DispatchQueue.main.sync { - for subscriber in self.subscribers { - action(subscriber) - } + for subscriber in subscribers { + action(subscriber) } } } @@ -142,7 +140,8 @@ extension AssetsManager { PHPhotoLibrary.requestAuthorization({ (status) in DispatchQueue.main.async { switch status { - case .authorized: + case .authorized, + .limited: completion(true) default: completion(false) @@ -381,7 +380,15 @@ extension AssetsManager { @discardableResult func notifyIfAuthorizationStatusChanged() -> Bool { - let newStatus = PHPhotoLibrary.authorizationStatus() + + var newStatus: PHAuthorizationStatus + + if #available(iOS 14, *) { + newStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite) + } else { + newStatus = PHPhotoLibrary.authorizationStatus() + } + if authorizationStatus != newStatus { let oldStatus = authorizationStatus authorizationStatus = newStatus @@ -391,7 +398,11 @@ extension AssetsManager { } } } - return authorizationStatus == .authorized + if #available(iOS 14, *) { + return authorizationStatus == .limited || authorizationStatus == .authorized + } else { + return authorizationStatus == .authorized + } } func isCountChanged(changeDetails: PHFetchResultChangeDetails) -> Bool { @@ -469,10 +480,13 @@ extension AssetsManager { if isRefetch { assetArray.removeAll() } - - // set default album - select(album: defaultAlbum ?? cameraRollAlbum) - + + guard let album = defaultAlbum ?? cameraRollAlbum else { + completion?([]) + return + } + + select(album: album) completion?(assetArray) } diff --git a/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift index 55a2314..9295b19 100644 --- a/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift +++ b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift @@ -6,8 +6,6 @@ // // -import SnapKit - fileprivate let kDimmerViewKey = "kDimmerViewKey" fileprivate let kDimmerView = "kDimmerView" fileprivate let kDimmerViewRatio = "kDimmerViewRatio" @@ -110,7 +108,7 @@ extension UIView { } else { addSubview(dimmer) } - dimmer.snp.makeConstraints { $0.edges.equalToSuperview() } + dimmer.fillToSuperview() dimmerView = dimmer } } @@ -145,9 +143,9 @@ extension UIView { } else { addSubview(dimmerActivity) } - dimmerActivity.snp.makeConstraints { (make) in - make.centerX.equalToSuperview() - make.centerY.equalToSuperview().multipliedBy(verticalRatio) + if let superview = dimmerActivity.superview { + dimmerActivity.centerXAnchor.constraint(equalTo: superview.centerXAnchor).isActive = true + dimmerActivity.centerYAnchor.constraint(equalTo: superview.centerYAnchor).isActive = true } dimmerActivity.startAnimating() dimmerActivityView = dimmerActivity diff --git a/AssetsPickerViewController/Classes/Library/Extensions/UIView+Layout.swift b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Layout.swift new file mode 100644 index 0000000..8357199 --- /dev/null +++ b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Layout.swift @@ -0,0 +1,97 @@ +// +// UIView+Layout.swift +// AssetsPicker +// +// Source: https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/UIKit/UIViewExtensions.swift#L457-L530 +// + +import UIKit + +extension UIView { + /// SwifterSwift: Anchor all sides of the view into it's superview. + @available(iOS 9, *) + func fillToSuperview() { + // https://videos.letsbuildthatapp.com/ + translatesAutoresizingMaskIntoConstraints = false + if let superview = superview { + let left = leftAnchor.constraint(equalTo: superview.leftAnchor) + let right = rightAnchor.constraint(equalTo: superview.rightAnchor) + let top = topAnchor.constraint(equalTo: superview.topAnchor) + let bottom = bottomAnchor.constraint(equalTo: superview.bottomAnchor) + NSLayoutConstraint.activate([left, right, top, bottom]) + } + } + + /// SwifterSwift: Add anchors from any side of the current view into the specified anchors and returns the newly added constraints. + /// + /// - Parameters: + /// - top: current view's top anchor will be anchored into the specified anchor + /// - left: current view's left anchor will be anchored into the specified anchor + /// - bottom: current view's bottom anchor will be anchored into the specified anchor + /// - right: current view's right anchor will be anchored into the specified anchor + /// - topConstant: current view's top anchor margin + /// - leftConstant: current view's left anchor margin + /// - bottomConstant: current view's bottom anchor margin + /// - rightConstant: current view's right anchor margin + /// - widthConstant: current view's width + /// - heightConstant: current view's height + /// - Returns: array of newly added constraints (if applicable). + @available(iOS 9, *) + @discardableResult + func anchor( + top: NSLayoutYAxisAnchor? = nil, + left: NSLayoutXAxisAnchor? = nil, + bottom: NSLayoutYAxisAnchor? = nil, + right: NSLayoutXAxisAnchor? = nil, + leading: NSLayoutXAxisAnchor? = nil, + trailing: NSLayoutXAxisAnchor? = nil, + topConstant: CGFloat = 0, + leftConstant: CGFloat = 0, + bottomConstant: CGFloat = 0, + rightConstant: CGFloat = 0, + leadingConstant: CGFloat = 0, + trailingConstant: CGFloat = 0, + widthConstant: CGFloat = 0, + heightConstant: CGFloat = 0) -> [NSLayoutConstraint] { + // https://videos.letsbuildthatapp.com/ + translatesAutoresizingMaskIntoConstraints = false + + var anchors = [NSLayoutConstraint]() + + if let top = top { + anchors.append(topAnchor.constraint(equalTo: top, constant: topConstant)) + } + + if let left = left { + anchors.append(leftAnchor.constraint(equalTo: left, constant: leftConstant)) + } + + if let bottom = bottom { + anchors.append(bottomAnchor.constraint(equalTo: bottom, constant: -bottomConstant)) + } + + if let right = right { + anchors.append(rightAnchor.constraint(equalTo: right, constant: -rightConstant)) + } + + if let leading = leading { + anchors.append(leadingAnchor.constraint(equalTo: leading, constant: leadingConstant)) + } + + if let trailing = trailing { + anchors.append(trailingAnchor.constraint(equalTo: trailing, constant: -trailingConstant)) + } + + if widthConstant > 0 { + anchors.append(widthAnchor.constraint(equalToConstant: widthConstant)) + } + + if heightConstant > 0 { + anchors.append(heightAnchor.constraint(equalToConstant: heightConstant)) + } + + anchors.forEach({$0.isActive = true}) + + return anchors + } +} diff --git a/AssetsPickerViewController/Classes/Photo/Controller/AssetsPhotoViewController.swift b/AssetsPickerViewController/Classes/Photo/Controller/AssetsPhotoViewController.swift index 2472099..c6ed489 100644 --- a/AssetsPickerViewController/Classes/Photo/Controller/AssetsPhotoViewController.swift +++ b/AssetsPickerViewController/Classes/Photo/Controller/AssetsPhotoViewController.swift @@ -9,8 +9,6 @@ import UIKit import Photos import PhotosUI -import Device -import SnapKit // MARK: - AssetsPhotoViewController open class AssetsPhotoViewController: UIViewController { @@ -62,9 +60,6 @@ open class AssetsPhotoViewController: UIViewController { fileprivate var isPortrait: Bool = true - var leadingConstraint: LayoutConstraint? - var trailingConstraint: LayoutConstraint? - fileprivate lazy var collectionView: UICollectionView = { let layout = AssetsPhotoLayout(pickerConfig: self.pickerConfig) @@ -183,8 +178,6 @@ open class AssetsPhotoViewController: UIViewController { @available(iOS 11.0, *) override open func viewSafeAreaInsetsDidChange() { super.viewSafeAreaInsetsDidChange() - leadingConstraint?.constant = view.safeAreaInsets.left - trailingConstraint?.constant = -view.safeAreaInsets.right updateLayout(layout: collectionView.collectionViewLayout) logi("\(view.safeAreaInsets)") } @@ -247,27 +240,26 @@ extension AssetsPhotoViewController { } func setupCollectionView() { - - collectionView.snp.makeConstraints { (make) in - make.top.equalToSuperview() - + if let superview = collectionView.superview { + let leadingAnchor, trailingAnchor: NSLayoutXAxisAnchor if #available(iOS 11.0, *) { - leadingConstraint = make.leading.equalToSuperview().inset(view.safeAreaInsets.left).constraint.layoutConstraints.first - trailingConstraint = make.trailing.equalToSuperview().inset(view.safeAreaInsets.right).constraint.layoutConstraints.first + leadingAnchor = superview.safeAreaLayoutGuide.leadingAnchor + trailingAnchor = superview.safeAreaLayoutGuide.trailingAnchor } else { - leadingConstraint = make.leading.equalToSuperview().constraint.layoutConstraints.first - trailingConstraint = make.trailing.equalToSuperview().constraint.layoutConstraints.first + leadingAnchor = superview.leadingAnchor + trailingAnchor = superview.trailingAnchor } - make.bottom.equalToSuperview() - } - - emptyView.snp.makeConstraints { (make) in - make.edges.equalToSuperview() + collectionView.anchor( + top: superview.topAnchor, + bottom: superview.bottomAnchor, + leading: leadingAnchor, + trailing: trailingAnchor + ) } + + emptyView.fillToSuperview() - noPermissionView.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } + noPermissionView.fillToSuperview() } func setupAssets() { @@ -720,14 +712,30 @@ extension AssetsPhotoViewController: AssetsAlbumViewControllerDelegate { // MARK: - AssetsManagerDelegate extension AssetsPhotoViewController: AssetsManagerDelegate { + private func shouldUpdateAssetCollectionView(oldStatus: PHAuthorizationStatus, newStatus: PHAuthorizationStatus) -> Bool { + if #available(iOS 14, *) { + if oldStatus != .limited || oldStatus != .authorized { + if newStatus == .limited || newStatus == .authorized { + return true + } + } + } else { + if oldStatus != .authorized { + if newStatus == .authorized { + return true + } + } + } + return false + } + public func assetsManager(manager: AssetsManager, authorizationStatusChanged oldStatus: PHAuthorizationStatus, newStatus: PHAuthorizationStatus) { - if oldStatus != .authorized { - if newStatus == .authorized { + if shouldUpdateAssetCollectionView(oldStatus: oldStatus, newStatus: newStatus) { updateNoPermissionView() AssetsManager.shared.fetchAssets(isRefetch: true, completion: { [weak self] (_) in self?.collectionView.reloadData() }) - } + } else { updateNoPermissionView() } @@ -742,12 +750,16 @@ extension AssetsPhotoViewController: AssetsManagerDelegate { logw("selected album is nil.") return } - if albums.contains(selectedAlbum) { - select(album: manager.defaultAlbum ?? manager.cameraRollAlbum) + if albums.contains(selectedAlbum), let fallbackAlbum = manager.defaultAlbum ?? manager.cameraRollAlbum { + select(album: fallbackAlbum) } } - public func assetsManager(manager: AssetsManager, updatedAlbums albums: [PHAssetCollection], at indexPaths: [IndexPath]) {} + public func assetsManager(manager: AssetsManager, updatedAlbums albums: [PHAssetCollection], at indexPaths: [IndexPath]) { + AssetsManager.shared.fetchAssets(isRefetch: true) { (_) in + self.collectionView.reloadData() + } + } public func assetsManager(manager: AssetsManager, reloadedAlbum album: PHAssetCollection, at indexPath: IndexPath) {} public func assetsManager(manager: AssetsManager, insertedAssets assets: [PHAsset], at indexPaths: [IndexPath]) { diff --git a/AssetsPickerViewController/Classes/Photo/Controller/AssetsPreviewController.swift b/AssetsPickerViewController/Classes/Photo/Controller/AssetsPreviewController.swift index d142936..c5d7d6a 100644 --- a/AssetsPickerViewController/Classes/Photo/Controller/AssetsPreviewController.swift +++ b/AssetsPickerViewController/Classes/Photo/Controller/AssetsPreviewController.swift @@ -123,14 +123,10 @@ open class AssetsPreviewController: UIViewController { override open func viewDidLoad() { super.viewDidLoad() - - imageView.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } + + imageView.fillToSuperview() if #available(iOS 9.1, *) { - livePhotoView.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } + livePhotoView.fillToSuperview() } } diff --git a/AssetsPickerViewController/Classes/Photo/View/AssetsFooterView.swift b/AssetsPickerViewController/Classes/Photo/View/AssetsFooterView.swift index 2c4c5a5..fcd5dc0 100644 --- a/AssetsPickerViewController/Classes/Photo/View/AssetsFooterView.swift +++ b/AssetsPickerViewController/Classes/Photo/View/AssetsFooterView.swift @@ -30,9 +30,7 @@ open class AssetsPhotoFooterView: UICollectionReusableView { private func commonInit() { addSubview(countLabel) - countLabel.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } + countLabel.fillToSuperview() } open func set(imageCount: Int, videoCount: Int) { diff --git a/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCell.swift b/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCell.swift index 046d830..43f1b30 100644 --- a/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCell.swift +++ b/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCell.swift @@ -99,26 +99,27 @@ open class AssetsPhotoCell: UICollectionViewCell, AssetsPhotoCellProtocol { contentView.addSubview(panoramaIconView) contentView.addSubview(overlay) - imageView.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } - - durationLabel.snp.makeConstraints { (make) in - make.height.equalTo(durationLabel.font.pointSize + 10) - make.leading.equalToSuperview().offset(8) - make.trailing.equalToSuperview().inset(8) - make.bottom.equalToSuperview() - } + imageView.fillToSuperview() + + durationLabel.anchor( + bottom: contentView.bottomAnchor, + leading: contentView.leadingAnchor, + trailing: contentView.trailingAnchor, + leadingConstant: 8, + trailingConstant: 8, + heightConstant: durationLabel.font.pointSize + 10 + ) - panoramaIconView.snp.makeConstraints { (make) in - make.size.equalTo(CGSize(width: 14, height: 7)) - make.trailing.equalToSuperview().inset(6.5) - make.bottom.equalToSuperview().inset(10) - } + panoramaIconView.anchor( + bottom: contentView.bottomAnchor, + trailing: contentView.trailingAnchor, + bottomConstant: 10, + trailingConstant: 6.5, + widthConstant: 14, + heightConstant: 7 + ) - overlay.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } + overlay.fillToSuperview() } open override func layoutSubviews() { diff --git a/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCellOverlay.swift b/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCellOverlay.swift index 4babf96..f87a24c 100644 --- a/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCellOverlay.swift +++ b/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoCellOverlay.swift @@ -47,13 +47,15 @@ open class AssetsPhotoCellOverlay: UIView { addSubview(countLabel) addSubview(checkmark) - countLabel.snp.makeConstraints { (make) in - make.edges.equalToSuperview() - } - checkmark.snp.makeConstraints { (make) in - make.size.equalTo(CGSize(width: 30, height: 30)) - make.bottom.equalToSuperview().inset(1) - make.trailing.equalToSuperview().inset(1) - } + countLabel.fillToSuperview() + + checkmark.anchor( + bottom: superview?.bottomAnchor, + trailing: superview?.trailingAnchor, + bottomConstant: 1, + trailingConstant: 1, + widthConstant: 30, + heightConstant: 30 + ) } } diff --git a/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoLayout.swift b/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoLayout.swift index f6f63f8..7603eb1 100644 --- a/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoLayout.swift +++ b/AssetsPickerViewController/Classes/Photo/View/AssetsPhotoLayout.swift @@ -7,7 +7,6 @@ // import UIKit -import Device open class AssetsPhotoLayout: UICollectionViewFlowLayout { diff --git a/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift b/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift index cf132a7..c1dcdc6 100644 --- a/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift +++ b/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift @@ -57,13 +57,13 @@ open class AssetsPickerConfig { open var albumCellType: AnyClass = AssetsAlbumCell.classForCoder() open var albumDefaultSpace: CGFloat = 20 open var albumLineSpace: CGFloat = -1 - public let albumPortraitDefaultColumnCount: Int = UI_USER_INTERFACE_IDIOM() == .pad ? 3 : 2 + public let albumPortraitDefaultColumnCount: Int = UIDevice.current.userInterfaceIdiom == .pad ? 3 : 2 open var albumPortraitColumnCount: Int? open var albumPortraitForcedCellWidth: CGFloat? open var albumPortraitForcedCellHeight: CGFloat? open var albumPortraitCellSize: CGSize = .zero - public let albumLandscapeDefaultColumnCount: Int = UI_USER_INTERFACE_IDIOM() == .pad ? 4 : 3 + public let albumLandscapeDefaultColumnCount: Int = UIDevice.current.userInterfaceIdiom == .pad ? 4 : 3 open var albumLandscapeColumnCount: Int? open var albumLandscapeForcedCellWidth: CGFloat? open var albumLandscapeForcedCellHeight: CGFloat? @@ -98,7 +98,7 @@ open class AssetsPickerConfig { return _assetCacheSize } } - open var assetPortraitColumnCount: Int = UI_USER_INTERFACE_IDIOM() == .pad ? 5 : 4 + open var assetPortraitColumnCount: Int = UIDevice.current.userInterfaceIdiom == .pad ? 5 : 4 open var assetPortraitInteritemSpace: CGFloat = 1 open var assetPortraitLineSpace: CGFloat = 1 diff --git a/AssetsPickerViewController/Classes/Picker/Controller/AssetsPickerViewController.swift b/AssetsPickerViewController/Classes/Picker/Controller/AssetsPickerViewController.swift index a8412ab..54682af 100644 --- a/AssetsPickerViewController/Classes/Picker/Controller/AssetsPickerViewController.swift +++ b/AssetsPickerViewController/Classes/Picker/Controller/AssetsPickerViewController.swift @@ -10,7 +10,7 @@ import UIKit import Photos // MARK: - AssetsPickerViewControllerDelegate -@objc public protocol AssetsPickerViewControllerDelegate: class { +@objc public protocol AssetsPickerViewControllerDelegate: AnyObject { @objc optional func assetsPickerDidCancel(controller: AssetsPickerViewController) @objc optional func assetsPickerCannotAccessPhotoLibrary(controller: AssetsPickerViewController) func assetsPicker(controller: AssetsPickerViewController, selected assets: [PHAsset]) diff --git a/AssetsPickerViewController/Classes/Picker/View/AssetsGuideView.swift b/AssetsPickerViewController/Classes/Picker/View/AssetsGuideView.swift index 48d63ff..a65d007 100644 --- a/AssetsPickerViewController/Classes/Picker/View/AssetsGuideView.swift +++ b/AssetsPickerViewController/Classes/Picker/View/AssetsGuideView.swift @@ -34,12 +34,14 @@ open class AssetsGuideView: UIView { func commonInit() { backgroundColor = .white addSubview(messageLabel) - messageLabel.snp.makeConstraints { (make) in - make.top.equalToSuperview() - make.leading.equalToSuperview().inset(15) - make.bottom.equalToSuperview() - make.trailing.equalToSuperview().inset(15) - } + messageLabel.anchor( + top: superview?.topAnchor, + bottom: superview?.bottomAnchor, + leading: superview?.leadingAnchor, + trailing: superview?.trailingAnchor, + leadingConstant: 15, + trailingConstant: 15 + ) } open func set(title: String, message: String) { diff --git a/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift b/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift index ea5cbe0..c872937 100644 --- a/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift +++ b/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift @@ -5,8 +5,6 @@ // Created by DragonCherry on 19/12/2017. // -import Device - extension Device { static func safeAreaInsets(isPortrait: Bool) -> UIEdgeInsets { let size = Device.size() @@ -18,3 +16,245 @@ extension Device { } } } + +// The following code is from: https://github.com/Ekhoo/Device/ +// It's copied here so that no extra depenency is required for AssetsPicker framework users + +class Device { + private static func size() -> Size { + let w: Double = Double(UIScreen.main.bounds.width) + let h: Double = Double(UIScreen.main.bounds.height) + let screenHeight: Double = max(w, h) + + switch screenHeight { + case 480: + return .screen3_5Inch + case 568: + return .screen4Inch + case 667: + return UIScreen.main.scale == 3.0 ? .screen5_5Inch : .screen4_7Inch + case 736: + return .screen5_5Inch + case 812: + return .screen5_8Inch + case 896: + return UIScreen.main.scale == 3.0 ? .screen6_5Inch : .screen6_1Inch + case 1024: + switch version() { + case .iPadMini,.iPadMini2,.iPadMini3,.iPadMini4: + return .screen7_9Inch + case .iPadPro10_5Inch: + return .screen10_5Inch + default: + return .screen9_7Inch + } + case 1112: + return .screen10_5Inch + case 1366: + return .screen12_9Inch + default: + return .unknownSize + } + } + + static fileprivate func getVersionCode() -> String { + var systemInfo = utsname() + uname(&systemInfo) + + let versionCode: String = String(validatingUTF8: NSString(bytes: &systemInfo.machine, length: Int(_SYS_NAMELEN), encoding: String.Encoding.ascii.rawValue)!.utf8String!)! + + return versionCode + } + + static fileprivate func getVersion(code: String) -> Version { + switch code { + /*** iPhone ***/ + case "iPhone3,1", "iPhone3,2", "iPhone3,3": return .iPhone4 + case "iPhone4,1", "iPhone4,2", "iPhone4,3": return .iPhone4S + case "iPhone5,1", "iPhone5,2": return .iPhone5 + case "iPhone5,3", "iPhone5,4": return .iPhone5C + case "iPhone6,1", "iPhone6,2": return .iPhone5S + case "iPhone7,2": return .iPhone6 + case "iPhone7,1": return .iPhone6Plus + case "iPhone8,1": return .iPhone6S + case "iPhone8,2": return .iPhone6SPlus + case "iPhone8,3", "iPhone8,4": return .iPhoneSE + case "iPhone9,1", "iPhone9,3": return .iPhone7 + case "iPhone9,2", "iPhone9,4": return .iPhone7Plus + case "iPhone10,1", "iPhone10,4": return .iPhone8 + case "iPhone10,2", "iPhone10,5": return .iPhone8Plus + case "iPhone10,3", "iPhone10,6": return .iPhoneX + case "iPhone11,2": return .iPhoneXS + case "iPhone11,4", "iPhone11,6": return .iPhoneXS_Max + case "iPhone11,8": return .iPhoneXR + + + /*** iPad ***/ + case "iPad1,1", "iPad1,2": return Version.iPad1 + case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4": return Version.iPad2 + case "iPad3,1", "iPad3,2", "iPad3,3": return Version.iPad3 + case "iPad3,4", "iPad3,5", "iPad3,6": return Version.iPad4 + case "iPad6,11", "iPad6,12": return Version.iPad5 + case "iPad7,5", "iPad 7,6": return Version.iPad6 + case "iPad4,1", "iPad4,2", "iPad4,3": return Version.iPadAir + case "iPad5,3", "iPad5,4": return Version.iPadAir2 + case "iPad2,5", "iPad2,6", "iPad2,7": return Version.iPadMini + case "iPad4,4", "iPad4,5", "iPad4,6": return Version.iPadMini2 + case "iPad4,7", "iPad4,8", "iPad4,9": return Version.iPadMini3 + case "iPad5,1", "iPad5,2": return Version.iPadMini4 + case "iPad6,7", "iPad6,8", "iPad7,1", "iPad7,2": return Version.iPadPro12_9Inch + case "iPad7,3", "iPad7,4": return Version.iPadPro10_5Inch + case "iPad6,3", "iPad6,4": return Version.iPadPro9_7Inch + + /*** iPod ***/ + case "iPod1,1": return .iPodTouch1Gen + case "iPod2,1": return .iPodTouch2Gen + case "iPod3,1": return .iPodTouch3Gen + case "iPod4,1": return .iPodTouch4Gen + case "iPod5,1": return .iPodTouch5Gen + case "iPod7,1": return .iPodTouch6Gen + + /*** Simulator ***/ + case "i386", "x86_64": return .simulator + + default: return .unknown + } + } + + static fileprivate func getType(code: String) -> Type { + let versionCode = getVersionCode() + + if versionCode.contains("iPhone") { + return .iPhone + } else if versionCode.contains("iPad") { + return .iPad + } else if versionCode.contains("iPod") { + return .iPod + } else if versionCode == "i386" || versionCode == "x86_64" { + return .simulator + } else { + return .unknown + } + } + + static private func version() -> Version { + return getVersion(code: getVersionCode()) + } +} + +private enum Size: Int, Comparable { + case unknownSize = 0 + #if os(iOS) + /// iPhone 4, 4s, iPod Touch 4th gen. + case screen3_5Inch + /// iPhone 5, 5s, 5c, SE, iPod Touch 5-6th gen. + case screen4Inch + /// iPhone 6, 6s, 7, 8 + case screen4_7Inch + /// iPhone 6+, 6s+, 7+, 8+ + case screen5_5Inch + /// iPhone X, Xs + case screen5_8Inch + /// iPhone Xr + case screen6_1Inch + /// iPhone Xs Max + case screen6_5Inch + /// iPad Mini + case screen7_9Inch + /// iPad + case screen9_7Inch + /// iPad Pro (10.5-inch) + case screen10_5Inch + /// iPad Pro (12.9-inch) + case screen12_9Inch + #elseif os(OSX) + case screen11Inch + case screen12Inch + case screen13Inch + case screen15Inch + case screen17Inch + case screen20Inch + case screen21_5Inch + case screen24Inch + case screen27Inch + #endif +} + +private func <(lhs: Size, rhs: Size) -> Bool { + return lhs.rawValue < rhs.rawValue +} + +private func ==(lhs: Size, rhs: Size) -> Bool { + return lhs.rawValue == rhs.rawValue +} + +private enum Version: String { + /*** iPhone ***/ + case iPhone4 + case iPhone4S + case iPhone5 + case iPhone5C + case iPhone5S + case iPhone6 + case iPhone6Plus + case iPhone6S + case iPhone6SPlus + case iPhoneSE + case iPhone7 + case iPhone7Plus + case iPhone8 + case iPhone8Plus + case iPhoneX + case iPhoneXS + case iPhoneXS_Max + case iPhoneXR + + /*** iPad ***/ + case iPad1 + case iPad2 + case iPad3 + case iPad4 + case iPad5 + case iPad6 + case iPadAir + case iPadAir2 + case iPadMini + case iPadMini2 + case iPadMini3 + case iPadMini4 + case iPadPro9_7Inch + case iPadPro10_5Inch + case iPadPro12_9Inch + + /*** iPod ***/ + case iPodTouch1Gen + case iPodTouch2Gen + case iPodTouch3Gen + case iPodTouch4Gen + case iPodTouch5Gen + case iPodTouch6Gen + + /*** simulator ***/ + case simulator + + /*** unknown ***/ + case unknown +} + +private enum Type: String { + #if os(iOS) + case iPhone + case iPad + case iPod + case simulator + #elseif os(OSX) + case iMac + case macMini + case macPro + case macBook + case macBookAir + case macBookPro + case xserve + #endif + case unknown +} diff --git a/AssetsPickerViewController/Classes/Utility/UIScreen+AssetsPickerViewController.swift b/AssetsPickerViewController/Classes/Utility/UIScreen+AssetsPickerViewController.swift index e1dcd3b..b6a3c76 100644 --- a/AssetsPickerViewController/Classes/Utility/UIScreen+AssetsPickerViewController.swift +++ b/AssetsPickerViewController/Classes/Utility/UIScreen+AssetsPickerViewController.swift @@ -7,7 +7,6 @@ // import UIKit -import Device extension UIScreen { diff --git a/AssetsPickerViewController/Info.plist b/AssetsPickerViewController/Info.plist new file mode 100644 index 0000000..e1fe4cf --- /dev/null +++ b/AssetsPickerViewController/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/Example/AssetsPickerViewController.xcodeproj/project.pbxproj b/Example/AssetsPickerViewController.xcodeproj/project.pbxproj index 67eaef1..7df3cb3 100644 --- a/Example/AssetsPickerViewController.xcodeproj/project.pbxproj +++ b/Example/AssetsPickerViewController.xcodeproj/project.pbxproj @@ -344,13 +344,11 @@ inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-AssetsPickerViewController_Example/Pods-AssetsPickerViewController_Example-frameworks.sh", "${BUILT_PRODUCTS_DIR}/AssetsPickerViewController/AssetsPickerViewController.framework", - "${BUILT_PRODUCTS_DIR}/Device/Device.framework", "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AssetsPickerViewController.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Device.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Example/AssetsPickerViewController/ExampleUsages/CustomAlbumCellController.swift b/Example/AssetsPickerViewController/ExampleUsages/CustomAlbumCellController.swift index dc8d730..3ca510c 100644 --- a/Example/AssetsPickerViewController/ExampleUsages/CustomAlbumCellController.swift +++ b/Example/AssetsPickerViewController/ExampleUsages/CustomAlbumCellController.swift @@ -9,6 +9,7 @@ import UIKit import Photos import AssetsPickerViewController +import SnapKit private let imageSize = CGSize(width: 80, height: 80) diff --git a/Example/Podfile b/Example/Podfile index 521974b..40f7bf9 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -2,6 +2,7 @@ use_frameworks! platform :ios, '10.0' target 'AssetsPickerViewController_Example' do + pod 'SnapKit' pod 'AssetsPickerViewController', :path => '../' end diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 0297a3a..38c9cb4 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,16 +1,13 @@ PODS: - - AssetsPickerViewController (2.6.2): - - Device - - SnapKit - - Device (3.1.2) + - AssetsPickerViewController (2.6.2) - SnapKit (5.0.0) DEPENDENCIES: - AssetsPickerViewController (from `../`) + - SnapKit SPEC REPOS: https://github.com/cocoapods/specs.git: - - Device - SnapKit EXTERNAL SOURCES: @@ -18,10 +15,9 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - AssetsPickerViewController: ed908abbff9ff818c031b5c54cffa2f8efb93155 - Device: 62242076214c30fb5760174b3601cefafa70a481 + AssetsPickerViewController: 825ff1a77e406e45fc3267bc0587db3eebf8b099 SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf -PODFILE CHECKSUM: ed535a80c7e9986ea173935163bbd69a1c717311 +PODFILE CHECKSUM: 99436430fecf7e3f417c5ddfb455b1f8bc732b32 COCOAPODS: 1.6.1