Giter Site home page Giter Site logo

papermissions's Introduction

#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

Compatibility

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

If you are looking for the Swift 2 version of it, please check out the legacy branch

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To integrate PAPermissions into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'PAPermissions'

Then, run the following command:

$ pod install

Carthage

Add this to Cartfile

github "ReactiveX/RxSwift" "3.0.0-beta.1"
$ carthage update

Manual Installation

Just copy the PAPermissions folder in your project

Run the Example

Clone the repo, cd into Example:

$ 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

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!

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 [email protected]

papermissions's People

Contributors

pascalbros avatar joeblau avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.