Eureka is open sourcing its iOS Assets Picker library, Mosaique

Antoine Marandon
Eureka Engineering
Published in
2 min readJan 24, 2020

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/

--

--