CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Oct 2017 |
| SwiftSwift Version | 4.0 |
| SPMSupports SPM | ✗ |
Maintained by Mikael Bäckman.
| Depends on: | |
| FBSDKCoreKit | ~> 4.21.0 |
| FBSDKLoginKit | ~> 4.21.0 |
A simple image picker for Facebook written in Swift. Looks and works very similar to the native UIImagePickerController, except it uses a completion block instead of a delegate protocol.
Download the project or clone the repo. Import the MBImagePicker folder into your project. Make sure you have the FBSDKCoreKit, FBSDKCoreKit, and Bolts frameworks imported.
Make sure that your application has been setup with the Facebook SDK.
Import the library:
import MBFacebookImagePickerShow the picker:
let imagePicker = MBFacebookImagePickerController()
imagePicker.finishedCompletion = { [weak self] (result) in
self?.dismiss(animated: true, completion: nil)
switch result {
case .completed(let image): self?.imageView.image = image
case .failed(let error): print("failed with error: \(error)")
case .cancelled: print("Cancelled!")
}
}
present(imagePicker, animated: true, completion: nil)Note that the app needs to have been authenticated with Facebook and given permission to access user_photos before showing the image picker.
MBImagePicker uses the following translation keys:
"MBIMAGEPICKER_NO_ALBUMS_FOUND" = "No albums found";
"MBIMAGEPICKER_ALBUMS" = "Albums";
"MBIMAGEPICKER_ERROR_ALERT_TITLE" = "Ooops...";
"MBIMAGEPICKER_NETWORK_ERROR" = "Network unavailable, please try again";
"MBIMAGEPICKER_UNKNOWN_ERROR" = "Something went wrong, please try again";
"MBIMAGEPICKER_NO_PICTURES_FOUND" = "Could not find any pictures\nin your photo album";
"MBIMAGEPICKER_CANCEL" = "Cancel";
"MBIMAGEPICKER_OK" = "OK";
Add the keys to your localizable.strings and modify the strings for you respective language(s).
MBFacebookImagePicker is available under the MIT license. See the LICENSE file for more info.