AnyImagePicker
是一个支持多张照片、GIF 或视频的图像选择库。它是用 Swift 编写的。
功能
- 支持浅色模式、深色模式或自动模式
- 默认主题类似微信
- 多选和混合选择支持
- 支持的媒体类型
- 照片
- GIF
- Live Photo
- 视频
- 摄像头
- 编辑图片
- 多平台支持
- iOS
- iPadOS
- Mac Catalyst (技术预览)
- macOS
- tvOS
要求
- iOS 10.0+
- Xcode 11.0+
- Swift 5.0+
安装
CocoaPods
将此代码添加到 Podfile
中,然后更新依赖关系。
pod 'AnyImagePicker'
Carthage
将此添加到 Cartfile
中,然后更新依赖项
github "AnyImageProject/AnyImagePicker"
不支持
--no-use-binaries
使用说明
快速开始
import AnyImagePicker
let controller = ImagePickerController(delegate: self)
present(controller, animated: true, completion: nil)
/// ImagePickerControllerDelegate
func imagePicker(_ picker: ImagePickerController, didSelect assets: [Asset], useOriginalImage: Bool) {
let image = assets.image
// Your code
}
获取内容数据
/// 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
}
许可协议
AnyImagePicker 在 MIT 许可协议下发布。有关详细信息,请参阅 LICENSE。