leimeimei / AnyImageKit

A toolbox for pick/edit/capture photo or video. Written in Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AnyImageKit

GitHub Actions CocoaPods Compatible Carthage Compatible Platform License

AnyImageKit is a toolbox for picking and editing photos. It's written in Swift.

中文说明

Features

  • Light mode, dark mode or auto mode support
  • Default theme is similar with Wechat
  • Multiple & mix select support
  • Supported media types:
    • Photo
    • GIF
    • Live Photo
    • Video
  • Camera
    • Photo
    • Video
    • Live Photo
    • GIF
    • Fliter
  • Edit image ( Technical Preview )
    • Drawing
    • Emoji
    • Input text
    • Cropping
    • Mosaic
    • Rotate
    • Fliter
  • Multiple platform support
    • iOS
    • iPadOS
    • Mac Catalyst ( Technical Preview, Not support in editor. Remove from support as Xcode 12.0 can't support Mac Catalyst 14.0 features. )
    • macOS
    • tvOS

Requirements

  • iOS 10.0+
  • Xcode 12.0+
  • Swift 5.3+

Installation

⚠️ Needs Xcode 12.0+ to support resources and localization files

dependencies: [
    .package(url: "https://github.com/AnyImageProject/AnyImageKit.git", .upToNextMajor(from: "0.9.0"))
]

Add this to Podfile, and then update dependency:

pod 'AnyImageKit'

Add this to Cartfile, and then update dependency:

github "AnyImageProject/AnyImageKit"

⚠️ Unsupport in Xcode 12.0, more details

Usage

Prepare

Add these keys to your Info.plist when needed:

Key Module Info
NSPhotoLibraryUsageDescription Picker
NSPhotoLibraryAddUsageDescription Picker
PHPhotoLibraryPreventAutomaticLimitedAccessAlert Picker Set YES to prevent automatic limited access alert in iOS 14+ (Picker has been adapted with Limited features that can be triggered by the user to enhance the user experience)
NSCameraUsageDescription Capture
NSMicrophoneUsageDescription Capture

Quick Start

import AnyImageKit

class ViewController: UIViewController {

    @IBAction private func openPicker() {
        let options = PickerOptionsInfo()
        let controller = ImagePickerController(options: options, delegate: self)
        present(controller, animated: true, completion: nil)
    }
}

extension ViewController: ImagePickerControllerDelegate {

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

Quick Look

License

AnyImageKit is released under the MIT license. See LICENSE for details.

About

A toolbox for pick/edit/capture photo or video. Written in Swift.

License:MIT License


Languages

Language:Swift 99.2%Language:Shell 0.3%Language:Ruby 0.2%Language:Metal 0.2%Language:Objective-C 0.1%