Skip to content

Latest commit

 

History

History
62 lines (28 loc) · 2.48 KB

README.md

File metadata and controls

62 lines (28 loc) · 2.48 KB

📹 MediaPicker

MediaPicker is a SPM which fills the gap of Apples UIPickerViewController. It provides us the functionality to select multiple media assets at a time.

Architecture

SS1

Implementation

Implementation of MediaPicker is really easy and simple. So in-order to present Media Picker we initially need to create a configuration for it.

SS2

So there are two form of configuration in media picker.

  1. MediaPicker System Config

This involves the internal configuration required for Media Picker. We need to be very careful when selecting this configurations, since this would directly lead to app perfomance.

  1. MediaPicker Config

MediaPicker config includes the System config along with basic configurations required for Media Picker. Eg: Selection Limit & Media types to fetch

Once you are done with the configuration, then you just need to present the MediaPicker. Now presentation of media picker includes two methods

  1. Delegation Based

Here present the picker normally, and confirm to its delegate, and you will be able to use the necessary methods.

SS3

Make sure you go through the code and understand what are the different types of configurations

  1. Completion Based

Here an extension is written for MediaPicker, which can be directly used to present it

SS4

Now all you need to do is configure your code as per the need.

In our codebase, implementation of MediaPicker is done via DeviceImagePicker. So there is no need of direct implementation of the same.

Under the hood ⚙️

Lets understand how under the hood Media Picker works with the following flow chart:

SS5

Initially Media Picker check for the Authorisation status, accordingly it takes the action. If Request is granted then the MPStoreManager will fetch all the assets and start rendering. If request is not determined then it will ask for permission and finally if access is restricted it will throw error.