Eureka is open sourcing its iOS Assets Picker library, Mosaique

Antoine Marandon
Jan 24 · 2 min read

Illustration

Motivations

VS the default `UIImagePickerController `

`UIImagePickerController` is great, and comes with some advantages (reduced code size, no permissions needed), but comes with some serious flaw, such as limited integrations, no customisations, and no multi assets picking.

VS a third party library

While there a (a lot) of Assets Picker libraries that offer very good alternatives, we wanted to go a bit further:
- Let you (optionally) write your own view controllers using our MVVM architecture
- Customisable header cell
- Streamlined, background download of cloud assets
- Dynamically reloading the collections when the user update them

Where are we using it:

How does it works:

Client side:

Simply create the view controller and setup the delegate:

Or set some opions…

Implementation details and features

Default configuration options :

  • Single or multi selection mode (up to N assets)
  • Asset selection color
  • Navigation items tint
  • Number of items per row
  • Localisation
  • Custom cells (will override the asset selection color)
  • Custom header view
  • Media type (video, image, …)
  • Scroll animations

MVVM Architecture

Altho we do provide some advanced customisation options, we use an open MVVM Architecture that makes it easy to reimplement custom view controllers in case you want to make a completely different UX (carousel asset picker anyone?)

Crazy fast asynchronous loading

To make the scrolling experience as smooth as possible we use only asynchronous loading. The list of assets/ collections is fetched (and kept in sync) through a `PHFetchRequest`. When displayed, we first load a low resolutions thumbnails and then streaming higher resolutions one as soon as the `PHCachingImageManager` can generate them, cancelling the request when the image is not displayed anymore.

Conclusion

We hope you’ll find this library interesting, take a look at https://github.com/eure/AssetsPicker/

Eureka Engineering

Learn about Eureka’s engineering efforts, product developments and more.

Antoine Marandon

Written by

French software engineer working in Tokyo

Eureka Engineering

Learn about Eureka’s engineering efforts, product developments and more.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade