Swiftpack.co - Package - AnyImageProject/AnyImageKit

AnyImageKit

GitHub Actions CocoaPods Compatible Carthage Compatible Platform License

AnyImageKit is a toolbox for picking, editing or capturing photos/videos, 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 Support
  • ☐ Edit image ( Technical Preview )
    • ☑ Drawing
    • ☐ Emoji
    • ☑ Input text
    • ☑ Cropping
    • ☑ Mosaic
    • ☐ Rotate
    • ☐ Fliter Support
  • ☐ 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.2+
  • Swift 5.3+

Installation

Swift Package Manager

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

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

CocoaPods

Add this to Podfile, and then update dependency:

pod 'AnyImageKit'

Carthage

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(_ sender: UIButton) {
        var options = PickerOptionsInfo()
        /*
          Your code, handle custom options
        */
        let controller = ImagePickerController(options: options, delegate: self)
        present(controller, animated: true, completion: nil)
    }
}

extension ViewController: ImagePickerControllerDelegate {

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

Release Notes

License

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

Github

link
Stars: 276

Dependencies

Used By

Total: 0

Releases

iOS 14++ -

更新说明

General

  • AnyImageKit is now adapt for the latest iPhone 12/12 Pro series devices.

New Features

  • Core
    • Added ImageKitDataTrackDelegate for track page/event, supported page and events can be find HERE.
  • Picker
    • Picker now observe photo library changes on all supported iOS versions and loads library changes automatically.
    • Added preselection mode, set PickerOptionsInfo.preselectAssets: [String] to enable preselection.

Resolved

  • Picker
    • Unify the color of the toolbar and navigation bar on selection.
    • Fixed an issue that picker reload photo library multiple times.
    • Fixed an issue that lose progress when fetch video from iCloud in iOS 14.
    • Now open the album will locate the current album.
  • Editor
    • Fixed an issue that the crop box going black in iOS 11.
    • When entering text in the editor, return key now shows as done instead of return.
  • Capture
    • Fixed an issue that the focus frame going black in iOS 11.

Incompatible changes

  • Picker/Editor/Capture now has an empty initialization method required init() and has changed the old method from required init(options: ...) to convenience init(options: ...) , to make it easier to subclass related items.
  • The delegate access control of Picker/Editor/Capture changes to open instead of open private(set) and can be changed after initialization.
  • The update(options: ...) method has been added in Picker/Editor/Capture, which should call before present.

iOS 14 & SPM -

更新说明

General

  • AnyImageKit build with Xcode 12 instead of Xcode 11.
  • AnyImageKit use Swift Package Manager as dependency instead of Cocoapods.
  • AnyImageKit support Swift Package Manager.

New Features

  • Picker
    • Adapt iOS 14 “Limited Photos Library” mode.
  • Editor
    • Pen colors support UIColorWell in iOS 14.

BREAKING CHANGE

We have modified the callback methods of the three modules to prepare for the stability of ABI in the future.

Picker

/// Original callback method
func imagePicker(_ picker: ImagePickerController, didFinishPicking assets: [Asset], useOriginalImage: Bool)
/// New callback method
/// PickerResult contains assets and useOriginalImage property
func imagePicker(_ picker: ImagePickerController, didFinishPicking result: PickerResult)

Editor

/// Original callback method
func imageEditor(_ editor: ImageEditorController, didFinishEditing mediaURL: URL, type: MediaType, isEdited: Bool)
/// New callback method
/// EditorResult contains mediaURL, type and isEdited property
func imageEditor(_ editor: ImageEditorController, didFinishEditing result: EditorResult)

Capture

/// Original callback method
func imageCapture(_ capture: ImageCaptureController, didFinishCapturing mediaURL: URL, type: MediaType)
/// New callback method
/// CaptureResult contains mediaURL and type property
func imageCapture(_ capture: ImageCaptureController, didFinishCapturing result: CaptureResult)

Other BREAKING CHANGE

  • Editor
    • For support UIColorWell feature, the penColors property has been changed from [UIColor] to [EditorPenColorOption].

Resolved

  • Picker
    • Fixed a bug that not clearing selected assets when switching albums.
    • Fixed a bug that the status of the toolbar at the bottom not update when switching albums.
    • Fixed a bug that the "camera item" appears repeatedly when switching albums.
  • Editor
    • Fixed an issue that the global breakpoint will be triggered at the first startup.
    • Fixed a bug that incomplete color display when input text.

Known Issues

  • Remove from support as Xcode 12.0 can't support Mac Catalyst 14.0 features.

Fix Xcode 12 simulator error -

  • Xcode 12 simulator error

Improved Capture -

New

  • Use Metal shader workflow instead of Core Image, which improved capture performance.
  • Use XCFramework for Binary Distribution.

Initial support for Xcode 12 -

  • fix compiler error for Xcode 12 beta 1

Capture support iPad -

Added

  • Picker:
    • Add autoCalculateColumnNumber, in iOS column number is columnNumber, in iPadOS column number will calculated by device orientation or device size.

Updated

  • Capture:
    • Support iPad, in iPadOS will use UIImagePickerController instead.

New features -

Added:

  • Picker:

    • QuickPick: It will select photo instead of show preview controller when you click photo on asset picker controller.
  • Editor:

    • EditorCropOption: Crop photo with custom crop options.

Now you can use Picker and Editor to pick square avatar. Open AvatarPickerController in example project to know how to configure Picker and Editor.

Updated:

  • Picker:
    • Support iPad.
  • Editor:
    • Can run on iPad but not perfect. Editor will exit when device rotation.

Fixed:

  • Picker:
    • App will stuck when fetch iCloud photo without network.
  • Editor:
    • Pen will lost sometime.
    • Enter text will lost when photo scale.

Bug Fix -

Fix:

  • Error when use front capture
  • Improve Editor

Remove ParsedOptionsInfo/OptionsInfoItem -

Update

  • Remove ParsedOptionsInfo/OptionsInfoItem

Capture -

New

  • Add Capture module
  • Add Video Editor, support clip video
  • Photo Editor support input text
  • All module support accessibility

Fix Video Export -

Fix

  • Fix video export progress

User Created Albums -

New:

  • add AlbumOptions in ImagePickerController.Config

Prepare for Multiple Windows -

  • Remove singleton design for Picker/Editor manager.
  • AnyImageKit will support Multiple Windows later.
  • Optimize memory usage. Now you can select 20 photos directly.

Edtior -

New

  • Support image editor (Technical Preview)

Important

  • Project has renamed to AnyImageKit

iPad & Mac Catalyst -

New

  • Support iPad
  • Support Mac Catalyst (Technical Preview)

Support Carthage Final -

Fix:

  • Carthage Support

Join in AnyImageProject -

Fix:

  • Fix small touch area for return button when preview.
  • Fix Carthage build.

New:

  • Support LivePhoto.
  • Support capture photos or videos.

Hello World -

Hello, everyone!

This is our first pre-release, maybe has some bugs. Open an issue or pull request, we will solve it soon.