Skip to content
This repository has been archived by the owner on Mar 6, 2018. It is now read-only.

sunshinejr/RxPermission

Repository files navigation

RxPermission

CocoaPods Version License Platform

RxSwift bindings for Permission API that helps you with Permissions in iOS.

Installation

RxPermission is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "RxPermission"

Usage

RxPermission makes a rx_permission Observable that you can subscribe in order to receive signals.

Sample code

Permission
    .Contacts
    .rx_permission
    .subscribeNext { status in
        print("Status: \(status)")
    }
    .addDisposableTo(disposeBag)

Available permissions:

public enum PermissionType {
    case Contacts
    case LocationAlways
    case LocationWhenInUse
    case Notifications
    case Microphone
    case Camera
    case Photos
    case Reminders
    case Events
    case Bluetooth
    case Motion
}

Available statuses:

public enum PermissionStatus {
    case Authorized
    case Denied
    case Disabled
    case NotDetermined
}

For more info about permissions and statuses, please visit Permission's README.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Sunshinejr, [email protected], @thesunshinejr

License

RxPermission is available under the MIT license. See the LICENSE file for more info.