Skip to content

A modern library for selecting photos and videos from your gallery.

License

Notifications You must be signed in to change notification settings

SynthesOne/MediaPicker

Repository files navigation

MediaPicker

MediaPicker is a lightweight and flexible library for selecting media files from your gallery. It supports normal photos, videos, gifs and livePhoto. The library is written in pure Swift without any third-party solutions. The project was inspired by Telegram with its simplicity and elegance.

Demo

Please wait while the .gif files are loading...

Comon state: Selected view:
Limited access state: Change orientation:

Features

  • All media type support
  • iOS Deployment Target 15.0
  • Light/dark mode support
  • All orientations support
  • Sheet presentation
  • Photos Viewer screen, with custom transitions
  • High performance, most animations are written in CALayer
  • Multilanguage support, ability to add your own language completely
  • Slide to select with auto scroll
  • iPad support
  • Selected assets view with drag and drop reodering

Todo

  • Custom font deploy
  • Add the ability to customise the presentation style
  • Minimise the presence of static properties and methods as much as possible
  • More functionality and UI configuration
  • Ability to replace used icons with custom icons
  • Add Custom camera
  • Write a detailed documentation
  • Rewrite the main screen to MVVM with Combine

Requirements

MediaPicker requires iOS 15 or above and is compatibile with Swift 5.

Installation

Swift Package Manager

MediaPicker is compatible with Swift Package Manager and can be integrated via Xcode. Select the main branch or the current release version

Usage

import MediaPicker

let mp = MPPresenter(sender: self)
let formatter = ByteCountFormatter()
mp.showMediaPicker(selectedResult: { (assets) in
    assets.forEach {
        print("Example selectedResult size \(String(describing: $0.size))")
        print("Example selectedResult readableUnit \(formatter.string(fromByteCount: Int64($0.size ?? 0)))")
        print("Example selectedResult fullFileName \(String(describing: $0.fullFileName))")
        print("Example selectedResult fileName \(String(describing: $0.fileName))")
        print("Example selectedResult mediaExtension \(String(describing: $0.fileExtension))")
        print("Example selectedResult mimeType \(String(describing: $0.mimeType))")
        print("Example selectedResult mediType \($0.type)")
    }
})

Advanced use cases can be seen in the Example App

About

A modern library for selecting photos and videos from your gallery.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages