Skip to content

Commit

Permalink
chore: release version 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Silence committed Jun 15, 2023
1 parent 44a082a commit 79b9e06
Show file tree
Hide file tree
Showing 1,242 changed files with 46,151 additions and 103,115 deletions.
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

270 changes: 270 additions & 0 deletions Documentation/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
<h4 align="right"><strong><a href="https://github.com/SilenceLove/HXPhotoPicker#readme">中文</a></strong> | English</h4>
<p align="center">
<a><img src="https://github.com/SilenceLove/HXPhotoPicker/blob/master/Documentation/Support/sample_graph_en.png" width = "396" height = "292.65" ></a>

<p align="center">
<a href="https://github.com/SilenceLove/HXPhotoPicker"><img src="https://badgen.net/badge/icon/iOS%2012.0%2B?color=cyan&icon=apple&label"></a>
<a href="https://github.com/SilenceLove/HXPhotoPicker"><img src="http://img.shields.io/cocoapods/v/HXPhotoPicker.svg?logo=cocoapods&logoColor=ffffff"></a>
<a href="https://developer.apple.com/Swift"><img src="http://img.shields.io/badge/language-Swift-orange.svg?logo=common-workflow-language"></a>
<a href="http://mit-license.org"><img src="http://img.shields.io/badge/license-MIT-333333.svg?logo=letterboxd&logoColor=ffffff"></a>
<div align="center"><a href="https://www.buymeacoffee.com/fengye" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a></div>
<div align="center">photo/video selector-supports LivePhoto, GIF selection, iCloud resource online download, photo/video editing</div>
</p>

## <a id="Features"></a> Features

- [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)

## <a id="Requirements"></a> 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/HXPhotoPicker.git", .upToNextMajor(from: "2.0"))
]
```

### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)

Add this to Podfile, and then update dependency:

```swift

iOS 12.0+
pod 'HXPhotoPicker'

/// No Kingfisher
pod `HXPhotoPicker/Lite`

/// Only Picker
pod `HXPhotoPicker/Picker`
pod `HXPhotoPicker/Picker/Lite`

/// Only Editor
pod `HXPhotoPicker/Editor`
pod `HXPhotoPicker/Editor/Lite`

/// Only Camera
pod `HXPhotoPicker/Camera`
/// Does not include location functionality
pod `HXPhotoPicker/Camera/Lite`

iOS 10.0+
pod 'HXPhotoPicker-Lite'
pod 'HXPhotoPicker-Lite/Picker'
pod 'HXPhotoPicker-Lite/Editor'
pod 'HXPhotoPicker-Lite/Camera'
```

### 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 HXPhotoPicker

class 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 |
| ---- | ---- | ---- | ---- | ---- |
| [v4.0.0](https://github.com/SilenceLove/HXPhotoPicker/blob/master/Documentation/RELEASE_NOTE.md#400) | 2023-06-15 | 14.3.0 | 5.7.0 | 12.0+ |

## License

HXPhotoPicker is released under the MIT license. See LICENSE for details.

## Support❤️
* [**★ Star**](#) this repo.
* Support with
<p/>
<a href="https://www.buymeacoffee.com/fengye" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a><p/>
<img src="https://github.com/SilenceLove/HXPhotoPicker/blob/master/Documentation/Support/bmc_qr.png" width = "135" height = "135" /><p/>
<img src="https://github.com/SilenceLove/HXPhotoPicker/blob/master/Documentation/Support/ap.jpeg" width = "100" height = "135.75" />
or
<img src="https://github.com/SilenceLove/HXPhotoPicker/blob/master/Documentation/Support/wp.jpeg" width = "100" height = "135.75" />


## Stargazers over time

[![Stargazers over time](https://starchart.cc/SilenceLove/HXPhotoPicker.svg)](https://starchart.cc/SilenceLove/HXPhotoPicker)

[🔝](#readme)


6 changes: 6 additions & 0 deletions Documentation/RELEASE_NOTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Release Notes

## 4.0.0

- Fixed some issues
- Editor optimization refactoring
11 changes: 11 additions & 0 deletions Documentation/RELEASE_NOTE_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 更新日志

## 4.0.0

- 纯Swift编写
- 修复了一些问题
- 编辑器优化重构

## 3.0

- [Object-C版本](https://github.com/SilenceLove/HXPhotoPicker/blob/main/README_OC.md)
Binary file added Documentation/Support/ap.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Support/bmc_qr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Support/sample_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Support/sample_graph_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Support/wp.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions HXPhotoPicker-Lite.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Pod::Spec.new do |spec|
spec.name = "HXPhotoPicker-Lite"
spec.version = "4.0.0"
spec.summary = "Photo selector - Support LivePhoto, GIF selection"
spec.homepage = "https://github.com/SilenceLove/HXPhotoPicker"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "SilenceLove" => "[email protected]" }
spec.swift_versions = ['5.0']
spec.ios.deployment_target = "10.0"
spec.source = { :git => "https://github.com/SilenceLove/HXPhotoPicker.git", :tag => "#{spec.version}" }
spec.framework = 'UIKit','Photos','PhotosUI'
spec.requires_arc = true

spec.default_subspec = 'Full'

spec.subspec 'Core' do |core|
core.source_files = "Sources/HXPhotoPicker/Core/**/*.{swift}"
core.resources = "Sources/HXPhotoPicker/Resources/*.{bundle}"
end

spec.subspec 'Picker' do |picker|
picker.subspec 'Lite' do |lite|
lite.source_files = "Sources/HXPhotoPicker/Picker/**/*.{swift}"
lite.dependency 'HXPhotoPicker-Lite/Core'
lite.pod_target_xcconfig = { 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'HXPICKER_ENABLE_PICKER' }
end
picker.subspec 'KF' do |kf|
kf.dependency 'HXPhotoPicker-Lite/Picker/Lite'
kf.dependency 'Kingfisher'
end
end

spec.subspec 'Editor' do |editor|
editor.subspec 'Lite' do |lite|
lite.source_files = "Sources/HXPhotoPicker/Editor/**/*.{swift}"
lite.dependency 'HXPhotoPicker-Lite/EditorView/Lite'
lite.pod_target_xcconfig = { 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'HXPICKER_ENABLE_EDITOR' }
end
editor.subspec 'KF' do |kf|
kf.dependency 'HXPhotoPicker-Lite/EditorView/KF'
kf.dependency 'HXPhotoPicker-Lite/Editor/Lite'
kf.dependency 'Kingfisher'
end
end

spec.subspec 'EditorView' do |editor_view|
editor_view.subspec 'Lite' do |lite|
lite.source_files = "Sources/HXPhotoPicker/Editor+View/**/*.{swift}"
lite.dependency 'HXPhotoPicker-Lite/Core'
lite.pod_target_xcconfig = { 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'HXPICKER_ENABLE_EDITOR_VIEW' }
end
editor_view.subspec 'KF' do |kf|
kf.dependency 'HXPhotoPicker-Lite/EditorView/Lite'
kf.dependency 'Kingfisher'
end
end

spec.subspec 'Camera' do |camera|
camera.subspec 'Lite' do |lite|
lite.source_files = "Sources/HXPhotoPicker/Camera/**/*.{swift,metal}"
lite.dependency 'HXPhotoPicker-Lite/Core'
lite.pod_target_xcconfig = { 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'HXPICKER_ENABLE_CAMERA' }
end
camera.subspec 'Location' do |loca|
loca.source_files = "Sources/HXPhotoPicker/Camera+Location/**/*.{swift}"
loca.dependency 'HXPhotoPicker-Lite/Camera/Lite'
loca.pod_target_xcconfig = { 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'HXPICKER_ENABLE_CAMERA_LOCATION' }
end
end

spec.subspec 'Lite' do |lite|
lite.dependency 'HXPhotoPicker-Lite/Picker/Lite'
lite.dependency 'HXPhotoPicker-Lite/Editor/Lite'
lite.dependency 'HXPhotoPicker-Lite/Camera/Lite'
end

spec.subspec 'Full' do |full|
full.dependency 'HXPhotoPicker-Lite/Picker'
full.dependency 'HXPhotoPicker-Lite/Editor'
full.dependency 'HXPhotoPicker-Lite/Camera'
end

spec.subspec 'NoLocation' do |noLocation|
noLocation.dependency 'HXPhotoPicker-Lite/Picker'
noLocation.dependency 'HXPhotoPicker-Lite/Editor'
noLocation.dependency 'HXPhotoPicker-Lite/Camera/Lite'
end
end
Loading

0 comments on commit 79b9e06

Please sign in to comment.