We've looked at allowing users to capture or choose images for use in our apps a couple times here. We learned about UIImagePickerController in Bite #83 and then ImagePicker in Bite #157.
Today we've got a new contender in this space called Fusuma. It's by Yuta Akizuki and aims to provide a very full-featured drop-in solution for this task. Let's try it.
We'll start by presenting the main FusumaViewController:
let fusuma = FusumaViewController()
fusuma.delegate = self
self.presentViewController(fusuma, animated: true, completion: nil)
Then later we conform to the FusumaDelegate protocol:
func fusumaImageSelected(image: UIImage) {
imageView.image = image
}
There's also fusumaDismissedWithImage
and fusumaCameraRollUnauthorized
functions for handling those cases.
More info about Fusuma can be found at git.io/fusuma