Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pascalbros/PAPermissions
A unified API to ask for permissions on iOS
https://github.com/pascalbros/PAPermissions
Last synced: 3 months ago
JSON representation
A unified API to ask for permissions on iOS
- Host: GitHub
- URL: https://github.com/pascalbros/PAPermissions
- Owner: pascalbros
- License: mit
- Created: 2016-09-06T23:10:37.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T21:09:08.000Z (about 4 years ago)
- Last Synced: 2024-04-23T19:19:11.885Z (6 months ago)
- Language: Swift
- Size: 6.11 MB
- Stars: 687
- Watchers: 15
- Forks: 67
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - PAPermissions - A unified API to ask for permissions on iOS. (Permissions / Other Parsing)
- awesome-ios-star - PAPermissions - A unified API to ask for permissions on iOS. (Permissions / Other Parsing)
README
# PAPermissions
PAPermissions is a fully customizable and ready-to-run library to handle permissions through a ViewController
Right now it supports out of the box permissions for:
- Address Book
- Bluetooth
- Calendar
- Camera
- Contacts
- Events
- Location
- Microphone
- Motion Fitness
- Notifications
- Reminders
- Custom![](./ReadmeResources/PAPermissions1.gif)
![](./ReadmeResources/PAPermissions2.gif)
![](./ReadmeResources/PAPermissions3.gif)
## CompatibilityPAPermissions requires iOS8+, compatible with both Swift 4 and Objective-C based projects
If you are looking for the Swift 2 version of it, please check out the [legacy branch](https://github.com/pascalbros/PAPermissions/tree/legacy)
If you are looking for the Swift 3 version of it, please check out the [legacy branch](https://github.com/pascalbros/PAPermissions/tree/swift3)
## Installation### CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects.
To integrate PAPermissions into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
pod 'PAPermissions'
```Then, run the following command:
```bash
$ pod install
```### Manual Installation
Just copy the PAPermissions folder in your project
## Run the Example
Clone the repo, cd into `Example`:
```bash
$ pod install
```Or open the project (the blue icon) and copy the PAPermissions folder inside.
## Screenshots
It can be used with a plain background color
![](./ReadmeResources/Screen1.png)Or with a background image
![](./ReadmeResources/Screen2.png)## How it works
Create a new UIViewController, inherit from *PAPermissionsViewController* and write:
```
let microphoneCheck = PAMicrophonePermissionsCheck()
let cameraCheck = PACameraPermissionsCheck()override func viewDidLoad() {
super.viewDidLoad()//Custom settings
self.locationCheck.requestAlwaysAuthorization = truelet permissions = [
PAPermissionsItem.itemForType(.microphone, reason: "Required to hear your beautiful voice")!,
PAPermissionsItem.itemForType(.camera, reason: "Required to shoot awesome photos")!]let handlers = [
PAPermissionsType.microphone.rawValue: self.microphoneCheck,
PAPermissionsType.camera.rawValue: self.cameraCheck]
self.setupData(permissions, handlers: handlers)self.titleText = "My Awesome App"
self.detailsText = "Please enable the following"
}```
That's it!
Anyway you no need to import everything, just remove the unnecessary "check" classes and keep the ones you want to use, you will find them in "Checks" folder.
## Contacts
We would love to know if you are using PAPermissions in your app, send an email to