pjebs / PAPermissions

A unified API to ask for permissions on iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

##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:

  • Bluetooth
  • Location
  • Notifications
  • Microphone
  • Camera
  • Custom

###Compatibility

PAPermissions requires iOS8+, compatible with both Swift 2/3 and Objective-C based projects

###Screenshots

It can be used with a plain background color

Or with a background image

###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 = true
		
		
		let 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!

README not finished yet...

About

A unified API to ask for permissions on iOS

License:MIT License


Languages

Language:Swift 100.0%