BRNImagePickerSheet is a duplicate of that shiny new custom action sheet seen in iOS8's iMessage that Apple didn't make part of UIKit. It's the first project I've written in Swift. It works well but I might have coded something the Objective-C kind of way. Don't hesitate to open an issue/ pullrequest if you spotted something.
I'm Laurin Brandner, I'm on Twitter.
BRNImagePickerSheet's API is similar to the one of UIActionSheet so you should get along with it just well.
let placeholder = BRNImagePickerSheet.selectedPhotoCountPlaceholder
var sheet = BRNImagePickerSheet()
sheet.addButtonWithTitle("Take Photo Or Video", singularSecondaryTitle: "Add Comment", pluralSecondaryTitle: nil)
sheet.addButtonWithTitle("Photo Library", singularSecondaryTitle: "Send \(placeholder) Photo", pluralSecondaryTitle: "Send \(placeholder) Photos")
sheet.delegate = self
sheet.showInView(self.view)
Note that you can use the placeholder to specify where BRNImagePickerSheet should insert the number of selected photos. This allows you to use very custom titles
func imagePickerSheet(imagePickerSheet: BRNImagePickerSheet, willDismissWithButtonIndex buttonIndex: Int) {
if buttonIndex != imagePickerSheet.cancelButtonIndex {
if imagePickerSheet.showsSecondaryTitles {
println(imagePickerSheet.selectedPhotos)
}
else {
let controller = UIImagePickerController()
controller.delegate = self
controller.sourceType = (buttonIndex == 2) ? .PhotoLibrary : .Camera
self.presentViewController(controller, animated: true, completion: nil)
}
}
}
BRNImagePickerSheet will be available via CocoaPods. However there's an issue with Swift compatibility that caused the build to fail. I will release it as soon as possible though.
(There is apparently an issue with Xcode6 and Swift static libs. Check out this issue for more.
BRNImagePickerSheet is written in Swift. It therefore runs on iOS 7 and 8.
BRNImagePickerSheet is licensed under the MIT License.