RxPhotos
This library is a tiny wrapper around some callback-based Photos' framework functions.
Usage
Request image:
PHImageManager.default().rx.requestImage(
for: asset,
targetSize: CGSize(width: 120, height: 200),
contentMode: PHImageContentMode.aspectFit,
options: nil
).subscribe(onNext: { image in
//
}).disposed(by: disposeBag)
Watch PHPhotoLibrary changes:
PHPhotoLibrary.shared().rx.photoLibraryChange
.subscribe(onNext: { change in
//
}).disposed(by: disposeBag)
Request authorization:
PHPhotoLibrary.rx.requestAuthorization()
.subscribe(onSuccess: { status in
//
}).disposed(by: disposeBag)
Perform changes on photo library:
PHPhotoLibrary.shared().rx.performChanges({ /**/ })
.subscribe(onSuccess: { result in
//
}).disposed(by: disposeBag)
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate RxPhotos into your Xcode project using CocoaPods, specify it in your Podfile
:
use_frameworks!
pod 'RxPhotos'
Then, run the following command:
$ pod install
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate RxPhotos into your Xcode project using Carthage, specify it in your Cartfile
:
github "istered/RxPhotos"
Run carthage update
to build the framework and drag the built RxPhotos
.framework into your Xcode project.
Dependencies
- RxSwift ~> 4.0
Requirements
- iOS 10+
- Swift 4.0+
Author
Anton Romanov
License
RxPhotos is available under the MIT license. See the LICENSE file for more info.