EasyAlbum 2.3.1

EasyAlbum 2.3.1

Ray维护。



EasyAlbum 2.3.1

EasyAlbum

Build Status Cocoapods platforms Cocoapods version Cocoapods license Language GitHub stars

功能

  • 支持单选、多选、预览、文件夹切换和拾取照片。
  • 在预览照片时,您可以缩放照片。
  • 根据您的项目颜色,设置您的选择颜色、导航栏背景颜色、导航栏栏背景颜色。
  • 根据您的偏好/需要,显示字段数量和选择的数量限制。
  • 支持语言🇹🇼繁体中文、🇨🇳简体中文,否则使用🇺🇸英语。

截图

Screenshots Portrait Screenshots Landscape

要求和详情

  • iOS 10.0+
  • Xcode 11.0+
  • 使用Swift 5.0+构建

安装

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它:

$ gem install cocoapods

要使用 CocoaPods 将 EasyAlbum 集成到您的 XCode 项目中,请在您的 Podfile 中将其指定为目标。

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
  # Use swift 5.0
  pod 'EasyAlbum', '~> 2.3.1'
end

在安装 CocoaPods 中的任何内容后,您应该打开 {Project}.xcworkspace 而不是 {Project}.xcodeproj

有关如何使用 CocoaPods 的更多信息,我建议您查阅这篇教程

Swift 包管理器

Swift 包管理器 是一个用于自动分发 Swift 代码的工具,集成到 swift 编译器中。目前处于早期开发阶段,但 Alamofire 支持其在受支持平台上的使用。

一旦您的 Swift 包设置完成,将 Alamofire 作为依赖项添加就像将其添加到 Package.swiftdependencies 值一样简单。

dependencies: [
    .package(url: "https://github.com/ray00178/EasyAlbum", .upToNextMajor(from: "2.3.1"))
]

使用方法

1. 打开您的 Info.plist 文件,并添加以下权限:

Photo Permission

<key>NSCameraUsageDescription</key>
<string>Please allow access to your camera then take picture.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Please allow access to your album then pick up photo.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Please allow access to your album then save photo.</string>

On iOS 14 later
<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
<true/>
2. 使用 EasyAlbum。您可以构建您想要的任何内容。
import EasyAlbum

/**
  * @param appName            : (required) (default: EasyAlbum)
  * @param tintColor          : (choose)   (default: #ffffff)     
  * @param barTintColor       : (choose)   (default: #673ab7) 
  * @param span               : (choose)   (default: 3)
  * @param limit              : (choose)   (default: 30)
  * @param orientation        : (choose)   (default: .all)
  * @param message            : (choose)   (default: Photo pick up the most `30(limitCount)`!)
  * @param pickColor          : (choose)   (default: #ffc107)
  * @param showCamera         : (choose)   (default: true)
  * @param crop               : (choose)   (default: false) (Use for camera)
  * @param isLightStatusStyle : (choose)   (default: true)
  * @param sizeFactor         : (choose)   (default: .auto)
  * @param orientation        : (choose)   (default: .all)
  * @param start              : (required)
  */

// Easy way
EasyAlbum.of(appName: "EasyAlbum")
         .start(self, delegate: self)

// Use many way
EasyAlbum.of(appName: "EasyAlbum")
         .limit(3)
         .sizeFactor(.fit(width: 1125.0, height: 2436.0))
         .orientation(.portrait)
         .start(self, delegate: self)
3. EasyAlbum 参数

EasyAlbum parameters

4. 扩展 EasyAlbumDelegate
extension ViewController: EasyAlbumDelegate {

    func easyAlbumDidSelected(_ photos: [AlbumData]) {
        // You can do something by selected.
        photos.forEach({ print("AlbumData 👉🏻 \($0)") })
    }
    
    func easyAlbumDidCanceled() {
        // You can do something by canceled. 
    }
}
5. AlbumData 👉🏻 你可以获取许多照片信息。
属性 类型 说明
图片 UIImage <UIImage: 0x600003377c60>, {1125, 752}
媒体类型 字符串 "image"
宽度 CGFloat 4555.0 原始宽度
高度 CGFloat 3041.0 原始高度
创建日期 日期? Optional(2013-11-05 11:08:39 +0000)
修改日期 日期? Optional(2019-04-13 14:34:57 +0000)
是否收藏 布尔 true
是否隐藏 布尔 false
位置 CLLocation? Optional(<+63.53140000,-19.51120000>)
文件名 字符串? Optional("DSC_5084.jpg")
文件数据 Data? Optional(8063276 字节)
文件大小 整型 8063276 字节 可能为零
文件UTI 字符串? Optional("public.jpeg")

更新描述

版本:2.3.1

  • 支持从 iOS 9.0 到 10.0。
  • 支持 iOS 14 有限 授权状态。
  • 改进了一些逻辑流程和代码。
  • 支持 Swift 包管理器 安装

版本:2.2.0

  • 优化 PhotoManager。
  • 修复 循环引用
  • 预览进入 过渡动画
  • 添加枚举 SizeFactor 属性 original

版本:2.1.0

  • 修复了下视图无法适应iPhone设备的问题。
  • 支持设备旋转。
  • 在预览页面上,您可以向上或向下滑动退出。
  • 添加了orientation属性,并删除了showGIFtitleColor属性。

通讯

  • 如发现bug,请创建问题报告。
  • 如有功能请求,请创建问题报告。
  • 如想贡献,提交一个pull请求。

待办列表

  • 预览退出过渡动画
  • 支持Live Photo
  • 支持SPM安装

许可证

EasyAlbum遵循MIT许可证。有关更多信息,请参阅LICENSE文件。

MIT License

Copyright (c) [2019] [Jhang, Pei-Yang(Ray)]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.