Here at MONK Software we strongly believe in collaborative software. Open Source community is something great and so huge that we just want to say thanks to everyone out there who keeps doing great projects/libraries & blog articles. Thanks for sharing!
During our latest iOS project, we needed something that Apple’s APIs don’t provide. We were searching for a sort of UIImagePicker with an embedded photo library, but we were unable to find something that would have suited our needs. So we just thought it would have been great to create something ad hoc for us and obviously share it this new component with the community and, just as obviously, release it Open Source.
It is an UIImagePickerController based component, but it adds capability to show photo library of our iDevices!
It is written in pure Swift 3 and it relies on Photos.framework provided by Apple. It is distributed under the MIT licence.
We choose Github & Cocoapods to distribute our library. Github because it’s the most popular open source site (AFAIK), and Cocoapods because it’s the de facto dependency manager in iOS.
Show me code!
Ok so, we are nerds, we write code! Show me code!
…well, You can read documentation…
I was joking man!
However documentation is pretty straightforward 🙂
to install library open your Podfile and add:
then, into a terminal shell, at the root of your iOS project, type:
this will download library. Now open Xcode, open a file and import library:
this will let you access custom component, now create it by typing:
let sheetController =AASheetController(barButtonItem: nil)
NB: in case you are displaying it for iPad, you should pass barButtonItem so controller will anchor to that.
If you prefer to hide cancel button at the bottom add:
if you don’t want to show photoLibrary:
the only thing which is requested is to add this line into Info.plist file of your project:
Privacy - Media Library Usage Description with a message you prefer (ex. We access photo library to share images on social networks)
That’s it, I hope you will enjoy this simple library. In case you have any doubts or requests, feel free to reply to this blog post or post a new issue on Github.