Permit framework provides a universal API for querying the permission status of different kinds of permissions, in an abstracted format with only what the user needs to know.
Permit framework provides a universal API for querying the permission status of different kinds of permissions, in an abstracted format with only what the user needs to know.
Ready to use of iOS 12+. For iOS only right now.
Permit can be installed throught Cocoapods
. CocoaPods is a dependency manager for Apple Platforms. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile
:
pod 'Permit'
Permit
aims to provide a very minimal API for accessing and requesting permissions for different use cases. For a list of available use cases, see available use cases.
Request status between isAuthorized
, isDenied
and isNotDetermined
like:
if Permit.isAuthorized(usecase: .camera) {
// do any stuff for authorised
} else {
// we know that it is either denied or not-determined..
// so, request permission which handles both usecases internally.
Permit.requestPermission(usecase: type, showPopupIfNeededOn: self) { result in
switch result {
case let .success(type):
// do permission granted stuff
case let .failure(error):
// show error dialog
}
}
You can also provide custom alert configs like:
struct DeniedAlertConfig: AlertConfig {
var title: String
var message: String
var cancelButtonText: String
var settingsButtonText: String
init() {
self.title = "Demo Denied Alert Title"
self.message = "Demo Denied Alert Message"
self.cancelButtonText = "Cancel"
self.settingsButtonText = "Settings"
}
}
And use them while requesting permissions as:
let config: AlertConfig = DeniedAlertConfig()
Permit.requestPermission(usecase: type,
showPopupIfNeededOn: self,
settingsDialogConfig: alertConfig) { result in }
We are welcoming any and all contributions in the framework from the community. We should together strive to make this framework better for everyone of us. To contribute:
main
branch along with issue.main
.version numbers
, feature
, bug
etc.