gitmyhub

PermissionsKit

Swift ★ 5.8k updated 1y ago

Universal API for request permission and get its statuses.

A Swift library for Apple platforms that gives your app a single, unified way to request and check the status of 16 system permissions, camera, microphone, location, contacts, and more, instead of writing different code for each.

SwiftSwiftUIUIKitSwift Package ManagerCocoaPodsiOSmacOSsetup: easycomplexity 2/5

PermissionsKit is a Swift library for Apple platforms that gives developers a single, consistent way to request and check the status of system permissions in their apps. When an iOS app wants to access the camera, microphone, location, contacts, or any other protected resource, it must first ask the user for permission. Each of these permissions normally requires different code to handle. PermissionsKit wraps all of them behind one unified interface.

The library supports sixteen permissions in total: Bluetooth, Calendar, Camera, Contacts, Face ID, Health, Location, Media Library, Microphone, Motion, Notifications, Photo Library, Reminders, Siri, Speech Recognizer, and App Tracking. For each, you can both request access and check the current status, which will be one of three states: authorized, denied, or not yet determined.

It works on iOS 12 and later, and also supports macOS, visionOS, tvOS, and watchOS. It is compatible with both UIKit and SwiftUI, the two main ways of building interfaces for Apple platforms. The library is set up as a modular package, meaning you only include the specific permissions your app actually needs rather than pulling in everything at once. The README notes this is important because Apple may reject apps that declare permissions they do not use.

Installation is available through Swift Package Manager, which is the modern standard for adding libraries to Apple platform projects, or through CocoaPods, an older dependency manager that the maintainer still supports but no longer recommends. Adding the library via Xcode requires pointing it at the GitHub repository URL and then selecting the specific permission modules needed.

No user interface components are included. The library only handles the logic of requesting and reading permission states.

Where it fits