A toolbox for picking and editing photo/video in Swift - Source App

AnyImageKit

Get an image/Video from the Custom photo library or directly from the camera by using the UIImagePickerController class in Swift 5.



  • language: Swift 5.0
  • platform: ios
  • device: iphone/ipad
  • license: MIT

Tag

Download

Installation

CocoaPods

Add this to Podfile, and then update dependency:

pod 'AnyImageKit'

Carthage

Add this to Cartfile, and then update dependency:

github "AnyImageProject/AnyImageKit"

Unsupport --no-use-binaries

Usage

Quick Start

import AnyImageKit

let controller = ImagePickerController(delegate: self)
present(controller, animated: true, completion: nil)

/// ImagePickerControllerDelegate
func imagePickerDidCancel(_ picker: ImagePickerController) {
    // Your code, handle cancel
    picker.dismiss(animated: true, completion: nil)
}
    
func imagePicker(_ picker: ImagePickerController, didFinishPicking assets: [Asset], useOriginalImage: Bool) {
    // Your code, handle select assets
    let images = assets.map { $0.image }
    picker.dismiss(animated: true, completion: nil)
}

Fetch content data

/// Fetch Video URL 
/// - Note: Only for `MediaType` Video
/// - Parameter options: Video URL Fetch Options
/// - Parameter completion: Video URL Fetch Completion
func fetchVideoURL(options: VideoURLFetchOptions = .init(), completion: @escaping VideoURLFetchCompletion)

// Call
asset.fetchVideoURL { (result) in
    // Your code
}



0 Comments: