📷 A lightweight, pure-Swift library for pick up photo from your album.
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate EasyAlbum into your XCode project using CocoaPods, specify it to a target in your 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
You should open the {Project}.xcworkspace
instead of the {Project}.xcodeproj
after you installed anything from CocoaPods.
For more information about how to use CocoaPods, I suggest this tutorial.
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but Alamofire does support its use on supported platforms.
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/ray00178/EasyAlbum", .upToNextMajor(from: "2.3.1"))
]
<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/>
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)
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.
}
}
You can get many photo information.
Attribute | Type | Value | Note |
---|---|---|---|
image | UIImage | <UIImage: 0x600003377c60>, {1125, 752} | |
mediaType | String | "image" | |
width | CGFloat | 4555.0 | Origin Width |
height | CGFloat | 3041.0 | Origin Height |
creationDate | Date? | Optional(2013-11-05 11:08:39 +0000) | |
modificationDate | Date? | Optional(2019-04-13 14:34:57 +0000) | |
isFavorite | Bool | true | |
isHidden | Bool | false | |
location | CLLocation? | Optional(<+63.53140000,-19.51120000>) | |
fileName | String? | Optional("DSC_5084.jpg") | |
fileData | Data? | Optional(8063276 bytes) | |
fileSize | Int | 8063276 bytes | Maybe zero |
fileUTI | String? | Optional("public.jpeg") |
limited
authorization status.Swift Package Manager
installretain cycle
.transition animation
.original
.iPhone
device.orientation
property and remove showGIF
& titleColor
property.bug
, open an issue.feature request
, open an issue.contribute
, submit a pull request.transition animation
Live Photo
SPM
installEasyAlbum is available under the MIT license. See the LICENSE file for more info.
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.