Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SilenceLove/HXPHPicker
Photo/Video Selector-Supports LivePhoto, GIF selection, online download of resources on iCloud, and editing of photos/videos
https://github.com/SilenceLove/HXPHPicker
editor photo picker swift video
Last synced: 7 days ago
JSON representation
Photo/Video Selector-Supports LivePhoto, GIF selection, online download of resources on iCloud, and editing of photos/videos
- Host: GitHub
- URL: https://github.com/SilenceLove/HXPHPicker
- Owner: SilenceLove
- License: mit
- Archived: true
- Created: 2020-12-30T06:20:24.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-17T08:52:16.000Z (over 1 year ago)
- Last Synced: 2024-05-02T05:07:40.284Z (6 months ago)
- Topics: editor, photo, picker, swift, video
- Language: Swift
- Homepage:
- Size: 45.6 MB
- Stars: 360
- Watchers: 7
- Forks: 74
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
中文 | English
Please move to HXPhotoPicker for the latest version
photo/video selector-supports LivePhoto, GIF selection, iCloud resource online download, photo/video editing
- [x] UI Appearance supports light/dark/auto/custom
- [x] Support multiple selection/mixed content selection
- [x] Supported media types:
- [x] Photo
- [x] GIF
- [x] Live Photo
- [x] Video
- [x] Supported local media types:
- [x] Photo
- [x] Video
- [x] GIF
- [x] Live Photo
- [x] Supported network media types:
- [x] Photo
- [x] Video
- [x] Support downloading assets on iCloud
- [x] Support gesture back
- [x] Support sliding selection
- [x] Edit pictures (support animated pictures, network pictures)
- [x] Graffiti
- [x] Sticker
- [x] Text
- [x] Crop
- [x] Mosaic
- [x] Filter
- [x] Edit video (support network video)
- [x] Graffiti
- [x] Stickers (support GIF)
- [x] Text
- [x] Soundtrack (support lyrics and subtitles)
- [x] Crop duration
- [x] Crop Size
- [x] Filter
- [x] Album display mode
- [x] Separate list
- [x] Pop-ups
- [x] Multi-platform support
- [x] iOS
- [x] iPadOS
- [x] Internationalization support
- [x] 🇨🇳 Chinese, Simplified (zh-Hans)
- [x] 🇬🇧 English (en)
- [x] 🇨🇳 Chinese, traditional (zh-Hant)
- [x] 🇯🇵 Japanese (ja)
- [x] 🇰🇷 Korean (ko)
- [x] 🇹🇭 Thai (th)
- [x] 🇮🇳 Indonesian (id)
- [x] 🇻🇳 Vietnamese (vi)
- [x] 🇷🇺 russian (ru)
- [x] 🇩🇪 german (de)
- [x] 🇫🇷 french (fr)
- [x] 🇸🇦 arabic (ar)
- [x] ✍️ Custom language (custom)
- [ ] 🤝 More support... (Pull requests welcome)
## Requirements- iOS 12.0+
- Xcode 12.5+
- Swift 5.4+## Installation
### [Swift Package Manager](https://swift.org/package-manager/)
⚠️ Needs Xcode 12.0+ to support resources and localization files
```swift
dependencies: [
.package(url: "https://github.com/SilenceLove/HXPHPicker.git", .upToNextMajor(from: "2.0.0"))
]
```### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
Add this to Podfile, and then update dependency:
```swift
iOS 12.0+
pod 'HXPHPicker'/// No Kingfisher
pod `HXPHPicker/Lite`/// Only Picker
pod `HXPHPicker/Picker`
pod `HXPHPicker/Picker/Lite`/// Only Editor
pod `HXPHPicker/Editor`
pod `HXPHPicker/Editor/Lite`/// Only Camera
pod `HXPHPicker/Camera`
/// Does not include location functionality
pod `HXPHPicker/Camera/Lite`iOS 10.0+
pod 'HXPHPicker-Lite'
pod 'HXPHPicker-Lite/Picker'
pod 'HXPHPicker-Lite/Editor'
pod 'HXPHPicker-Lite/Camera'
```### [Carthage](https://github.com/Carthage/Carthage)
Add the following content to `Cartfile` and perform dependency update.
```swift
github "SilenceLove/HXPHPicker"
```## Usage
> [Wiki](https://github.com/SilenceLove/HXPHPicker/wiki)
### Prepare
Add these keys to your Info.plist when needed:
| Key | Module | Info |
| ----- | ---- | ---- |
| NSPhotoLibraryUsageDescription | Picker | Allow access to album |
| NSPhotoLibraryAddUsageDescription | Picker | Allow to save pictures to album |
| 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 | Camera | Allow camera |
| NSMicrophoneUsageDescription | Camera | Allow microphone |### Quick Start
```swift
import HXPHPickerclass ViewController: UIViewController {
func presentPickerController() {
// Set the configuration consistent with the WeChat theme
let config = PickerConfiguration.default
// Method 1:
let pickerController = PhotoPickerController(picker: config)
pickerController.pickerDelegate = self
// The array of PhotoAsset objects corresponding to the currently selected asset
pickerController.selectedAssetArray = selectedAssets
// Whether to select the original image
pickerController.isOriginal = isOriginal
present(pickerController, animated: true, completion: nil)
// Method 2:
Photo.picker(
config
) { result, pickerController in
// Select completion callback
// result Select result
// .photoAssets Currently selected data
// .isOriginal Whether the original image is selected
// photoPickerController Corresponding photo selection controller
} cancel: { pickerController in
// Cancelled callback
// photoPickerController Corresponding photo selection controller
}
}
}extension ViewController: PhotoPickerControllerDelegate {
/// Called after the selection is complete
/// - Parameters:
/// - pickerController: corresponding PhotoPickerController
/// - result: Selected result
/// result.photoAssets Selected asset array
/// result.isOriginal Whether to select the original image
func pickerController(_ pickerController: PhotoPickerController,
didFinishSelection result: PickerResult) {
result.getImage { (image, photoAsset, index) in
if let image = image {
print("success", image)
}else {
print("failed")
}
} completionHandler: { (images) in
print(images)
}
}
/// Called when cancel is clicked
/// - Parameter pickerController: Corresponding PhotoPickerController
func pickerController(didCancel pickerController: PhotoPickerController) {
}
}
```### Get Content
#### Get UIImage
```swift
/// If it is a video, get the cover of the video
/// compressionQuality: Compress parameters, if not passed, no compression
photoAsset.getImage(compressionQuality: compressionQuality) { image in
print(image)
}
```#### Get URL
```swift
/// compression: Compress parameters, if not passed, no compression
photoAsset.getURL(compression: compression) { result in
switch result {
case .success(let urlResult):
switch urlResult.mediaType {
case .photo:
case .video:
}
switch urlResult.urlType {
case .local:
case .network:
}
print(urlResult.url)
// Image and video urls contained in LivePhoto
print(urlResult.livePhoto)
case .failure(let error):
print(error)
}
}
```## Release Notes
| Version | Release Date | Xcode | Swift | iOS |
| ---- | ---- | ---- | ---- | ---- |
| [v2.0.0](https://github.com/SilenceLove/HXPHPicker/blob/main/Documentation/RELEASE_NOTE.md#200) | 2023-06-14 | 14.3.0 | 5.7.0 | 12.0+ |
| [v1.4.6](https://github.com/SilenceLove/HXPHPicker/blob/main/Documentation/RELEASE_NOTE.md#146) | 2022-11-20 | 14.0.0 | 5.7.0 | 12.0+ |## License
HXPHPicker is released under the MIT license. See LICENSE for details.
## Support
* [**★ Star**](#) this repo.
* Support with
or
## Stargazers over time
[![Stargazers over time](https://starchart.cc/SilenceLove/HXPHPicker.svg)](https://starchart.cc/SilenceLove/HXPHPicker)
[🔝](#readme)