An elegant permission manager written in swift
Permission Manager
CocoaPods - Podfile
source 'https://github.com/lixiang1994/Specs'
// All
pod 'PermissionKit'
// Add separately
pod 'PermissionKit/Camera'
pod 'PermissionKit/Photos'
pod 'PermissionKit/Contacts'
pod 'PermissionKit/Event'
pod 'PermissionKit/Motion'
pod 'PermissionKit/Speech'
pod 'PermissionKit/Media'
pod 'PermissionKit/Siri'
pod 'PermissionKit/Location'
pod 'PermissionKit/Notification'
pod 'PermissionKit/Tracking'
pod 'PermissionKit/Bluetooth'
Carthage - Cartfile
github "lixiang1994/PermissionKit"
First make sure to import the framework:
import PermissionKit
Here are some usage examples. All devices are also available as simulators:
Provider.camera.isAuthorized
Provider.photos.isAuthorized
Provider.XXXXXX.isAuthorized
Provider.camera.request { (result) in
print("isAuthorized: \(result)")
}
Provider.XXXXXX.request { (result) in
print("isAuthorized: \(result)")
}
public protocol PermissionAlertable {
init(_ source: PermissionAlertContentSource)
func show(_ status: AlertStatus, with сompletion: @escaping (Bool) -> Void)
}
UIAlertController
let alert = SystemAlert(ChineseAlertContent())
Provider.camera.request(alert) { result in
/* ... */
}
CustomAlert need to implement PermissionAlertable
protocol
If you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue.
If you extended the functionality of PermissionKit yourself and want others to use it too, please submit a pull request.
PermissionKit is under MIT license. See the LICENSE file for more info.