lixiang1994 / PermissionKit

An elegant permission manager written in swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PermissionKit

Permission Manager

Swift

Features

  • Camera.
  • Photos.
  • Contacts.
  • Calendar.
  • Reminder.
  • Media Library.
  • Microphone.
  • Siri.
  • Motion.
  • Speech.
  • Location.
  • Notification.
  • AppTracking.
  • Bluetooth.

Installation

CocoaPods - Podfile

source 'https://github.com/lixiang1994/Specs'

// All
pod 'PermissionKit'

// Add separately
pod 'PermissionKit/Camera'
pod 'PermissionKit/Photos'
pod 'PermissionKit/Contacts'
pod 'PermissionKit/Event'
pod 'PermissionKit/Motion'
pod 'PermissionKit/Speech'
pod 'PermissionKit/Media'
pod 'PermissionKit/Siri'
pod 'PermissionKit/Location'
pod 'PermissionKit/Notification'
pod 'PermissionKit/Tracking'
pod 'PermissionKit/Bluetooth'

Carthage - Cartfile

github "lixiang1994/PermissionKit"

Usage

First make sure to import the framework:

import PermissionKit

Here are some usage examples. All devices are also available as simulators:

Property

Provider.camera.isAuthorized

Provider.photos.isAuthorized

Provider.XXXXXX.isAuthorized

Functions

Provider.camera.request { (result) in
    print("isAuthorized: \(result)")
}

Provider.XXXXXX.request { (result) in
    print("isAuthorized: \(result)")
}

Alert

Protocol

public protocol PermissionAlertable {

    init(_ source: PermissionAlertContentSource)

    func show(_ status: AlertStatus, with сompletion: @escaping (Bool) -> Void)
}

SystemAlert based UIAlertController

let alert = SystemAlert(ChineseAlertContent())
Provider.camera.request(alert) { result in
    /* ... */
}

CustomAlert need to implement PermissionAlertable protocol

Contributing

If you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue. If you extended the functionality of PermissionKit yourself and want others to use it too, please submit a pull request.

License

PermissionKit is under MIT license. See the LICENSE file for more info.

About

An elegant permission manager written in swift

License:MIT License


Languages

Language:Swift 93.1%Language:Ruby 5.9%Language:Objective-C 1.0%