Last active
April 12, 2021 06:56
-
-
Save yungblud/51af7c36465f471fa2a5d85d97f6f6a2 to your computer and use it in GitHub Desktop.
image picker source code swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func launchLibrary() -> Void { | |
| guard let callback = self.globalCallback else { return } | |
| let fetchOptions = PHFetchOptions() | |
| fetchOptions.includeAssetSourceTypes = .typeUserLibrary | |
| fetchOptions.sortDescriptors = [.init(key: "creationDate", ascending: false)] | |
| self.fetchedAssets = PHAsset.fetchAssets(with: .image, options: fetchOptions) | |
| self.imageShowerViewController = ImageShowerViewController(fetchedAssets: self.fetchedAssets, options: self.options, callback: callback) | |
| guard let imageShowerViewController = self.imageShowerViewController else { return } | |
| PHPhotoLibrary.shared().register(self) | |
| DispatchQueue.main.async { | |
| guard let rootViewController = RCTPresentedViewController() else { return } | |
| let navigationController = UINavigationController(rootViewController: imageShowerViewController) | |
| navigationController.modalPresentationStyle = .overFullScreen | |
| rootViewController.present(navigationController, animated: true, completion: nil) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment