FYPhoto is a photo/video picker and image browser library for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

Overview

FYPhoto

FYPhoto is an photo/video picker and browser for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation - Configuration - Usage - Languages - UI Customization

Give it a quick try : pod repo update then pod try FYPhoto

Those features are available just with a few lines of code!

Notable Features

📷 Photo
🎥 Video
✂️ Crop
⚡️ Flash
💧 Watermark
📁 Albums
🔢 Multiple Selection
📏 Video Trimming
And many more...

Requirements

iOS 11 or later

Installation

Using CocoaPods

First be sure to run pod repo update to get the latest version available.

Add pod 'FYPhoto' to your Podfile and run pod install. Also add use_frameworks! to the Podfile.

target 'MyApp'
pod 'FYPhoto'
use_frameworks!

Using Swift Package Manager

Swift Package Manager (SwiftPM) is a tool for managing the distribution of Swift code as well as C-family dependency. From Xcode 11, SwiftPM got natively integrated with Xcode.

FYPhoto support SwiftPM from version 2.1.0. To use SwiftPM, you should use Xcode 11 to open your project. Click File -> Swift Packages -> Add Package Dependency, enter FYPhoto repo's URL. Or you can login Xcode with your GitHub account and just type FYPhoto to search.

Plist entries

In order for your app to access camera and photo libraries, you'll need to ad these plist entries :

  • Privacy - Camera Usage Description (photo/videos)
  • Privacy - Photo Library Usage Description (library)
  • Privacy - Microphone Usage Description (videos)
<key>NSCameraUsageDescriptionkey>
<string>yourWordingstring>
<key>NSPhotoLibraryUsageDescriptionkey>
<string>yourWordingstring>
<key>NSMicrophoneUsageDescriptionkey>
<string>yourWordingstring>

Configuration

All the configuration endpoints are in the FYPhotoPickerConfiguration. Below are the default value for reference, feel free to play around :)

Picker

var pickerConfig = FYPhotoPickerConfiguration()
// [Edit configuration here ...]
// Build a picker with your configuration
let photoPicker = PhotoPickerViewController(configuration: pickerConfig)

General

pickerConfig.selectionLimit = 0
pickerConfig.supportCamera = true
pickerConfig.mediaFilter = [.image, .video]

// Color
let colorConfig = FYColorConfiguration()
colorConfig.topBarColor = FYColorConfiguration.BarColor(itemTintColor: .red,
                                                        itemDisableColor: .gray,
                                                        itemBackgroundColor: .black,
                                                        backgroundColor: .blue)

// Similar setting code for pickerBottomBarColor and browserBottomBarColor

pickerConfig.colorConfiguration = colorConfig

Video

pickerConfig.compressedQuality = .mediumQuality
pickerConfig.maximumVideoMemorySize = 40 // MB
pickerConfig.maximumVideoDuration = 15 // Secs

Browser

let photoBrowser = PhotoBrowserViewController.create(photos: photos, initialIndex: 0)
let photosBrowser = PhotoBrowserViewController.create(photos: [photo],
                                                      initialIndex: 0) {
            $0
                .buildPageControl()
                .buildBottomToolBar()
                .buildNavigationBar()
                .buildCaption()
                .buildThumbnailsForSelection()
                .showDeleteButtonForBrowser()
                .setMaximumCanBeSelected(1)
        }

Usage

First things first import FYPhoto.

Picker

let photoPickerVC = PhotoPickerViewController(configuration: pickerConfig)
    
photoPickerVC.selectedPhotos = { [weak self] images in
//            images.forEach {
//                $0.asset
//                $0.data
//                $0.image
//            }
}

photoPickerVC.selectedVideo = { [weak self] selectedResult in
    switch selectedResult {
    case .success(let video):
//                video.briefImage
//                video.url
    case .failure(let error):
        print("selected video error: \(error)")
    }
}
photoPickerVC.modalPresentationStyle = .fullScreen
self.present(photoPickerVC, animated: true, completion: nil)

Browser

let image = Photo.photoWithURL(url) // Similar init method for asset, image, data
let photoBrowser = PhotoBrowserViewController.create(photos: [image], initialIndex: 0)
// Use `.fyphoto` to easily bring smoothly drag-drop animation to your app.
self.fyphoto.present(photoBrowser, animated: true, completion: nil)

That's it !

Languages

🇺🇸 English, 🇨🇳 Chinese.

If your language is not supported, you can submit an issue or pull request with your Localizable.strings file to add a new language !

UI Customization

We tried to keep things as native as possible, so this is done mostly through native Apis.

References

This project references the following projects:

Dependency

FYPhoto relies on SDWebImage to provide async image downloader with cache support.

Obj-C support

Objective-C is not supported and this is not on our roadmap. Swift is the future and dropping Obj-C is the price to pay to keep our velocity on this library :)

Plan

Add more features to edit photo, include Filter, Mosaic, etc.

License

FYPhoto is released under the MIT license.

Swift Version

Swift 5.4.

You might also like...
iOS/macOS media picker for importing images and videos in SwiftUI

iOS/macOS media picker for importing images and videos in SwiftUI.

 🎯 Swift country and phone code Picker
🎯 Swift country and phone code Picker

CountryPicker Picker code Swift 3 / 4 / 5. Example To run the example project, clone the repo, and run pod install from the Example directory first. U

Date picker dialog for iOS
Date picker dialog for iOS

DatePickerDialog 4.0 - iOS - Swift DatePickerDialog is an iOS drop-in classe that displays an UIDatePicker within an UIAlertView. Requirements DatePic

a picker view shown as a popup for iOS in Objective-C
a picker view shown as a popup for iOS in Objective-C

CZPicker Demo Change Log 3 most recent changes are listed here. Full change logs v0.4.3 - 2016-08-12 Added - (void)czpickerViewWillDisplay:(CZPickerVi

A country picker view controller for iOS
A country picker view controller for iOS

Planet A country picker view controller for iOS. Installation CocoaPods You can use CocoaPods to install Planet by adding it to your Podfile: platform

MICountryPicker is a country picker controller for iOS8+ with an option to search.
MICountryPicker is a country picker controller for iOS8+ with an option to search.

MICountryPicker MICountryPicker is a country picker controller for iOS8+ with an option to search. The list of countries is based on the ISO 3166 coun

React-native-place-picker: Pick any place with single click 🚀
React-native-place-picker: Pick any place with single click 🚀

React-native-place-picker: Pick any place with single click 🚀

A SwiftUI implementation of a picker that also allows direct input.
A SwiftUI implementation of a picker that also allows direct input.

ComboPicker ComboPicker is a SwiftUI view that allows users to input a value by selecting from a predefined set or by typing a custom one. Installatio

🔸 A customizable alternative to UIPickerView in Swift.
🔸 A customizable alternative to UIPickerView in Swift.

PickerView PickerView is an easy to use and customize alternative to UIPickerView written in Swift. It was developed to provide a highly customizable

Comments
  • Unable to load image asset named albumArrow

    Unable to load image asset named albumArrow

    FYPhoto/XCAssets+Generated.swift:73: Fatal error: Unable to load image asset named albumArrow. 2022-10-17 20:51:53.338299+0300 XX[85366:1124261] FYPhoto/XCAssets+Generated.swift:73: Fatal error: Unable to load image asset named albumArrow.

    opened by omarshamali 1
Owner
null
A SwiftUI List Picker to replace system Picker in List

BetterListPicker An alternative customizable list picker in order to replace built-in non customizable Picker when we write settings view codes. Demo

Jinya 1 Apr 11, 2022
A better SwiftUI Picker Use _Picker instead of Picker

BetterPicker A better SwiftUI Picker. Use _Picker instead of Picker. Create styles with _PickerStyle. The is a WIP This library is currently a work-in

Eric Lewis 17 Dec 14, 2022
LocationPicker - A ready for use and fully customizable location picker for your app

LocationPicker A ready for use and fully customizable location picker for your app. Features Installation Cocoapods Carthage Swift Package Manager Qui

Zhuoran 397 Nov 16, 2022
A simple yet customizable horizontal and vertical picker view

WheelPicker A simple yet customizable horizontal and vertical picker view Features Vertical or Horizontal picker Image or Text data Configure UILabel

Mind Studios 74 Sep 26, 2022
A simple, customizable Country picker for picking country or dialing code. 🇮🇳 🇯🇵 🇰🇷 🇩🇪 🇨🇳 🇺🇸 🇫🇷 🇪🇸 🇮🇹 🇷🇺 🇬🇧

CountryPicker A simple, customizable Country picker for picking country or dialing code. This library is for country picker used in many app for selec

Suryakant 243 Dec 8, 2022
A drop in single image picker.

PHSingleImagePicker A low memory, single image picker wrapper that provide a significant smaller file size while also preserve high image quality. Int

Phanith NY 0 Nov 6, 2021
An iOS picker view to serve all your "picking" needs

Mandoline The PickerView is a UICollectionView that provides a smooth "picking" interface. In order to get the most out of it, a consuming view contro

Blue Apron 883 Nov 28, 2022
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Kizito Nwose 459 Dec 27, 2022
Elegant and Easy-to-Use iOS Swift Date Picker

D2PDatePicker Example To run the example project, clone the repo, and run pod install from the Example directory first. Example Code: Programmatical I

Pradheep Rajendirane 292 Nov 6, 2022
Multi-picker for iOS and Mac available in SwiftUI

Multi-picker for iOS and Mac available in Swift UI

1amageek 5 Jul 12, 2022