let you free steps for getting permission.
help you focus on the logic.
Imagine, now you want to open gallery. There are some inevitable steps.
- Check the permission
- If you can -> action
- If you can’t, the status will be
- Not determined -> request access permission
- If they accept the request -> action
- Denied -> induce them to access permission
- Not determined -> request access permission
These steps correspond to functions that require all permissions, not just the gallery.
PermissionCenter.video.action {
// do something what you want
}
if you don't have permission, Permission Center present alert depending on status.
before using, change the message if you want
PermissionCenterString.cancel = "cancel"
PermissionCenterString.allowAllPhotos = "allow all photos"
PermissionCenterString.useCurrentPhoto = "use now"
PermissionCenterString.openSettings = "settings"
PermissionCenterString.notNow = "later"
PermissionCenterString.selectMorePhotos = "add photos"
PermissionCenterString.deniedUserTitle = "alert"
PermissionCenterString.deniedUserMessage = "you had denied the permission.\nyou can change it on settings."
PermissionCenterString.limitedPhotoUserMessage = "access to part of photos."
<key>NSPhotoLibraryAddUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string></string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSLocationUsageDescription</key>
<string></string>
<key>NSLocationAlwaysUsageDescription</key>
<string></string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string></string>
<key>NSContactsUsageDescription</key>
<string></string>
<key>NSCameraUsageDescription</key>
<string></string>
To run the example project, clone the repo, and run pod install
from the Example directory first.
iOS 10.0
PermissionCenter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'PermissionCenter'
JuYeonYu, [email protected]
PermissionCenter is available under the MIT license. See the LICENSE file for more info.