Giter Site home page Giter Site logo

juju1982 / permissionskit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sparrowcode/permissionskit

0.0 0.0 0.0 109.4 MB

Universal API for request permission and get its statuses.

Home Page: https://sparrowcode.io/frameworks

License: MIT License

Ruby 8.76% Swift 91.24%

permissionskit's Introduction

PermissionsKit

Universal API for request permission and get its statuses. Available .authorized, .denied & .notDetermined.

Community

Navigate

Permissions

Icon Permission Key for Info.plist Get Status Make Request
Bluetooth NSBluetoothAlwaysUsageDescription, NSBluetoothPeripheralUsageDescription
Calendar NSCalendarsUsageDescription
Camera NSCameraUsageDescription
Contacts NSContactsUsageDescription
FaceID NSFaceIDUsageDescription
Health NSHealthUpdateUsageDescription, NSHealthShareUsageDescription
Location Always NSLocationAlwaysAndWhenInUseUsageDescription
Location When In Use NSLocationWhenInUseUsageDescription
Media Library NSAppleMusicUsageDescription
Microphone NSMicrophoneUsageDescription
Motion NSMotionUsageDescription
Notification
Photo Library NSPhotoLibraryUsageDescription, NSPhotoLibraryAddUsageDescription
Reminders NSRemindersUsageDescription
Siri NSSiriUsageDescription
Speech Recognizer NSSpeechRecognitionUsageDescription
Tracking NSUserTrackingUsageDescription

Installation

Ready to use on iOS 11+. Supports iOS, tvOS and SwiftUI.

Swift Package Manager

In Xcode go to Project -> Your Project Name -> Package Dependencies -> Tap Plus. Insert url:

https://github.com/sparrowcode/PermissionsKit

Next, choose the permissions you need. But don't add all of them, because apple will reject app. Or adding it to the dependencies of your Package.swift:

dependencies: [
    .package(url: "https://github.com/sparrowcode/PermissionsKit", .upToNextMajor(from: "9.0.0"))
]

and choose valid targets.

CocoaPods:

This is an outdated way of doing things. I advise you to use SPM. However, I will continue to support Cocoapods for some time.

Cocoapods Instalation

CocoaPods is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile:

pod 'PermissionsKit/NotificationPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'

Due to Apple's new policy regarding permission access you need to specifically define what kind of permissions you want to access using subspecs.

pod 'PermissionsKit/CameraPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/ContactsPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/CalendarPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/PhotoLibraryPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/NotificationPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/MicrophonePermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/RemindersPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/SpeechRecognizerPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/LocationWhenInUsePermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/LocationAlwaysPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/MotionPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/MediaLibraryPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/BluetoothPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/TrackingPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/FaceIDPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/SiriPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'
pod 'PermissionsKit/HealthPermission', :git => 'https://github.com/sparrowcode/PermissionsKit'

Request Permission

import PermissionsKit
import NotificationPermission

Permission.notification.request {
    
}

Status Permission

import PermissionsKit
import NotificationPermission

let authorized = Permission.notification.authorized

Keys in Info.plist

You need to add some keys to the Info.plist file with descriptions, per Apple's requirements. You can get a plist of keys for permissions as follows:

let key = Permission.bluetooth.usageDescriptionKey

Warning Do not use the description as the name of the key.

Localisation

If you use xliff localization export, keys will be create automatically. If you prefer do the localization file manually, you need to create InfoPlist.strings, select languages on the right side menu and add keys as keys in plist-file. See:

"NSCameraUsageDescription" = "Here description of usage camera";

Apps Using

If you use a PermissionsKit, add your application via Pull Request.

permissionskit's People

Contributors

ivanvorobei avatar romanpodymov avatar svyatoynick avatar dlackty avatar oggerschummer avatar jminutaglio avatar mohammad-rahchamani avatar neobeppe avatar cozzin avatar hengyu avatar tomkremer avatar moyoteg avatar matrixsenpai avatar jobinsjohn avatar evaanp avatar damarte avatar angcosmin avatar strobocop avatar parogc avatar mgt-la avatar duyhungtnn avatar dan12411 avatar utsavdave97 avatar srujanadicharla avatar sagaya avatar semty avatar rsickenberg avatar robertgolosynsky avatar rizwan95 avatar passatgt 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.