TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jan 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Sunshinejr.
RxSwift bindings for Permission API that helps you with Permissions in iOS.
RxPermission is available through CocoaPods. I can’t guarantee it is working correctly on Carthage, so if you want to help I’m happy to introduce it with your PR.
RxPermission should work with every Swift release >= 2.2, for detailed instructions check info below.
If you want to use RxPermission with Swift 3.0 you have to specify which Permission you want to install/use because of new Apple policy about permission. For example if you want to access the Camera and the Notifications you define the following:
pod 'RxPermission/Camera'
pod 'RxPermission/Notifications'
Available specs:
pod 'RxPermission/AddressBook'
pod 'RxPermission/Bluetooth'
pod 'RxPermission/Camera'
pod 'RxPermission/Contacts'
pod 'RxPermission/Events'
pod 'RxPermission/Location'
pod 'RxPermission/Microphone'
pod 'RxPermission/Motion'
pod 'RxPermission/Notifications'
pod 'RxPermission/Photos'
pod 'RxPermission/Reminders'
pod 'RxPermission/SpeechRecognizer'
pod 'RxPermission/MediaLibrary'
To install it, simply add the following line to your Podfile:
pod "RxPermission", "~> 0.2"
You need to also take care of Info.plist messages because otherwise Apple won’t accept the app in App Store.
RxPermission makes a rx_permission
Observable that you can subscribe in order to receive signals.
Permission
.Contacts
.rx.permission
.subscribeNext { status in
print("Status: \(status)")
}
.addDisposableTo(disposeBag)
public enum PermissionType {
case addressBook
case bluetooth
case camera
case contacts
case events
case motion
case microphone
case notifications
case photos
case reminders
case locationAlways
case locationWhenInUse
case mediaLibrary
case speechRecognizer
}
public enum PermissionStatus {
case authorized
case denied
case disabled
case notDetermined
}
For more info about permissions and statuses, please visit Permission’s README.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Sunshinejr, [email protected], @thesunshinejr
RxPermission is available under the MIT license. See the LICENSE file for more info.