SMInstagramPhotoPicker Create By Sweetman, Inc
- Same design as Instagram and animation.
- So easy to use.
- Support Swift 3.1
- Performances!
- Use GCD and ARC
- iOS 10.3 or later
- Xcode 8.3 or later
- swift 3.1
SMInstagramPhotoPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SMInstagramPhotoPicker"
import SMInstagramPhotoPicker
- In your controller.
var picker: SMPhotoPickerViewController?
-
First. It is importance to do this step.
-
Be sour your app have Authorization to assecc your photo library.
-
on your plist.info add one attrabute.
kye: Privacy - Photo Library Usage Description
String: Your app need assecc your photo library.
- And then request Authorization.
PHPhotoLibrary.requestAuthorization { (status) in
if status == .authorized {
self.picker = SMPhotoPickerViewController()
self.picker?.delegate = self
}
}
- Show!!!
//show picker. You need use present.
@IBAction func show(_ sender: UIButton) {
if picker != nil {
present(picker!, animated: true, completion: nil)
}
}
- Get your image through deledate.
class ViewController: UIViewController, SMPhotoPickerViewControllerDelegate {
//your viewcontroller
func didCancelPickingPhoto() {
print("User cancel picking image")
}
func didFinishPickingPhoto(image: UIImage, meteData: [String : Any]) {
imageView.image = image
}
}
All source code is licensed under the MIT License.
- Created by Sweetman, Inc on 2017.
- GuangZhou City. CN 510000
- https://www.sweetman.cc