Eureka is open sourcing its iOS Assets Picker library, Mosaique

Antoine Marandon
Jan 24 · 2 min read

Illustration

Image for post
Image for post

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…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store