AbraGallery 1.0.0

AbraGallery 1.0.0

测试已测试
Lang语言 SwiftSwift
许可证 MIT
Released最后发布2017年12月
SwiftSwift版本3.0
SPM支持SPM

Damian Kolakowski维护。



Gallery Banner

AbraGallery是一个用于图片和视频选择的库。它还提供视频录制功能。

用法

GalleryController是主入口点,只需实例化并设置代理即可

let gallery = GalleryController()
gallery.delegate2 = self
present(gallery, animated: true, completion: nil)

代理

GalleryControllerDelegate2需要您实现一些代理方法,以便与GalleryController交互

public protocol GalleryControllerDelegate2: class {
  func galleryController(_ controller: GalleryController, requestLightbox images: [UIImage])
  func galleryControllerDidCancel(_ controller: GalleryController)
  func galleryController(_ controller: GalleryController, didSelectAssets assets: [PHAsset])
}

权限

Gallery为您处理权限。它会在首次启动时检查并请求照片和相机使用权限。从iOS 10开始,我们需要在Plist文件中明确声明使用描述

<key>NSCameraUsageDescription</key>
<string>This app requires access to camera</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to photo library</string>

您可以通过配置Gallery.Config.Permission.shouldCheckPermission = false禁用权限流程

配置

Config结构体中有很多定制点。例如

Config.Permission.image = UIImage(named: ImageList.Gallery.cameraIcon)
Config.Font.Text.bold = UIFont(name: FontList.OpenSans.bold, size: 14)!
Config.Camera.recordLocation = true
Config.Camera.recordMode = .video                  // to enable video recording.
Config.VideoRecording.maxBytesCount = 1024         // to set the maximum size of video.
Config.VideoRecording.maxLengthInSeconds = .video  // to set the max length of video.
Config.Selection.mode = [.photo, .camera, .video]  // to enable/disable Photo, Camera and Video tabs.
Config.SessionPreset.quality = AVCaptureSessionPresetHigh // to define the quality of recorded video.

... and many many more at Config file.

安装

通过CocoaPods获取AbraGallery。要安装它,只需将以下行添加到Podfile中:

pod 'AbraGallery'

AbraGallery也可以手动安装。只需下载并将您的项目中的Sources文件夹拖入即可。

作者 & 联系方式

OpenSooq, [email protected], [email protected]

Abra Gallery是在Gallery项目之上构建的。

贡献

我们非常欢迎您向AbraGallery做出贡献,有关更多信息,请查看CONTRIBUTING文件。

许可证

AbraGallery可在MIT许可下获得。有关更多信息,请查看LICENSE文件。