Skip to content

LCPermissionsKit is a convenient wrapper on the macOS permissions API, including photos, contacts, reminders, and full disk access permissions

License

Notifications You must be signed in to change notification settings

DevLiuSir/LCPermissionsKit

Repository files navigation

 LCPermissionsKit is a convenient wrapper on the macOS permissions API, including photos, contacts, reminders, and full disk access permissions!

Swift Versions Supported Platforms

中文 | English

Current implementation supports permissions for:

Permission Type

public enum LCPermissionType: Int {
    case calendar = 0
    case reminders
    case contacts
    case photos
    case fullDiskAccess
}

Usage

  • Checking permission status
let status = LCPermissionsKit.shared.authorizationStatus(for: .fullDiskAccess)
switch status {
case .authorized:
    print("authorized")
case .notDetermined:
    print("notDetermined")
case .denied:
    print("denied")
case .limited:
    print("limited")
}
  • Request Permission
LCPermissionsKit.shared.requestAuthorization(for: .fullDiskAccess) { status in
	print(status)   
}

Calendar

10.9+

NSCalendarsUsageDescription key in info.plist is required.

Contacts

10.11+

NSContactsUsageDescription key is required in Info.plist

Reminders

10.9+

NSRemindersUsageDescription key is required in Info.plist

Photos

10.13+

NSPhotoLibraryUsageDescription key is required in Info.plist

Full Disk Access

10.14+

Calling for permissions opens Preferences->Privacy with selected "Full Disk Access" section.

Installation

CocoaPods

PermissionsKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'LCPermissionsKit'

SwiftPackage

Add https://github.com/DevLiuSir/LCPermissionsKit.git in the “Swift Package Manager” tab in Xcode.

License

MIT License

Copyright (c) 2024 Marvin

Author

DevLiuSir

Software Engineer

About

LCPermissionsKit is a convenient wrapper on the macOS permissions API, including photos, contacts, reminders, and full disk access permissions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published