[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7059":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},7059,"Permission","delba\u002FPermission","delba","A unified API to ask for permissions on iOS","",null,"Swift",2892,322,39,12,0,1,59.63,"MIT License",false,"master",true,[],"2026-06-12 04:00:32","\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fraw\u002Fassets\u002FPermission@2x.png\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Ftravis-ci.org\u002Fdelba\u002FPermission\">\u003Cimg alt=\"Travis Status\" src=\"https:\u002F\u002Fimg.shields.io\u002Ftravis\u002Fdelba\u002FPermission.svg\"\u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fimg.shields.io\u002Fcocoapods\u002Fv\u002FPermission.svg\">\u003Cimg alt=\"CocoaPods compatible\" src=\"https:\u002F\u002Fimg.shields.io\u002Fcocoapods\u002Fv\u002FPermission.svg\"\u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage\">\u003Cimg alt=\"Carthage compatible\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCarthage-compatible-4BC51D.svg?style=flat\"\u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\n**Permission** exposes a unified API to request permissions on iOS.\n\n\u003Cp align=\"center\">\n    \u003Ca href=\"#usage\">Usage\u003C\u002Fa> • \u003Ca href=\"#example\">Example\u003C\u002Fa> • \u003Ca href=\"#installation\">Installation\u003C\u002Fa> • \u003Ca href=\"#license\">License\u003C\u002Fa>\n\u003C\u002Fp>\n\n## Usage\n\n#### Permission\n\n> [`Permission.swift`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FPermission.swift)\n> [`PermissionStatus.swift`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FPermissionStatus.swift)\n\n```swift\nlet permission: Permission = .contacts\n\nprint(permission.status) \u002F\u002F .notDetermined\n\npermission.request { status in\n    switch status {\n    case .authorized:    print(\"authorized\")\n    case .denied:        print(\"denied\")\n    case .disabled:      print(\"disabled\")\n    case .notDetermined: print(\"not determined\")\n    }\n}\n```\n\n##### Supported Permissions\n\n> [`PermissionType.swift`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FPermissionType.swift)\n> [`Types\u002F`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Ftree\u002Fmaster\u002FSource\u002FTypes)\n\n- [`Bluetooth`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FBluetooth.swift)\n- [`Camera`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FCamera.swift)\n- [`Contacts`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FContacts.swift)\n- [`Events`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FEvents.swift)\n- [`Motion`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FMotion.swift)\n- [`Microphone`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FMicrophone.swift)\n- [`Notifications`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FNotifications.swift)\n- [`Photos`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FPhotos.swift)\n- [`Reminders`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FReminders.swift)\n- [`LocationAlways`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FLocationAlways.swift)\n- [`LocationWhenInUse`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FLocationWhenInUse.swift)\n- [`MediaLibrary`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FMediaLibrary.swift)\n- [`SpeechRecognizer`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FSpeechRecognizer.swift)\n- [`Siri`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FTypes\u002FSiri.swift)\n\n#### PermissionAlert\n\n> [`PermissionAlert.swift`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FPermissionAlert.swift)\n\n##### Denied and disabled alerts\n\nWhen you first request a permission, a system alert is presented to the user.\nIf you request a permission that was denied\u002Fdisabled, a `PermissionAlert` will be presented.\nYou might want to change the default `title`, `message`, `cancel` and `settings` text:\n\n```swift\nlet alert = permission.deniedAlert \u002F\u002F or permission.disabledAlert\n\nalert.title    = \"Please allow access to your contacts\"\nalert.message  = nil\nalert.cancel   = \"Cancel\"\nalert.settings = \"Settings\"\n```\n\nSet `permission.presentDeniedAlert = false` or `permission.presentDisabledAlert = false` if you don't want to present these alerts.\n\n##### Pre-permission alerts\n\nIn order not to burn your only chance of displaying the system alert, you can present a **pre-permission alert**. See this [article](http:\u002F\u002Ftechcrunch.com\u002F2014\u002F04\u002F04\u002Fthe-right-way-to-ask-users-for-ios-permissions\u002F) for more informations.\n\n```swift\npermission.presentPrePermissionAlert = true\n\nlet alert = permission.prePermissionAlert\n\nalert.title   = \"Let Foo Access Photos?\"\nalert.message = \"This lets you choose which photos you want to add to your Foo profile\"\nalert.cancel  = \"Not now\"\nalert.confirm = \"Give Access\"\n```\n\nThe system alert will only be presented if the user taps \"Give Access\".\n\n#### PermissionSet\n\n> [`PermissionSet.swift`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FPermissionSet.swift)\n\nUse a `PermissionSet` to check the status of a group of `Permission` and to react when a permission is requested.\n\n```swift\nlet permissionSet = PermissionSet(.contacts, .camera, .microphone, .photos)\npermissionSet.delegate = self\n\nprint(permissionSet.status) \u002F\u002F .notDetermined\n\n\u002F\u002F ...\n\nfunc permissionSet(permissionSet: PermissionSet, willRequestPermission permission: Permission) {\n    print(\"Will request \\(permission)\")\n}\n\nfunc permissionSet(permissionSet: PermissionSet, didRequestPermission permission: Permission) {\n    switch permissionSet.status {\n    case .authorized:    print(\"all the permissions are granted\")\n    case .denied:        print(\"at least one permission is denied\")\n    case .disabled:      print(\"at least one permission is disabled\")\n    case .notDetermined: print(\"at least one permission is not determined\")\n    }\n}\n```\n\n#### PermissionButton\n\n> [`PermissionButton`](https:\u002F\u002Fgithub.com\u002Fdelba\u002FPermission\u002Fblob\u002Fmaster\u002FSource\u002FPermissionButton.swift)\n\nA `PermissionButton` requests the permission when tapped and updates itself when its underlying permission status changes.\n\n```swift\nlet button = PermissionButton(.photos)\n```\n\n`PermissionButton` is a subclass of `UIButton`. All the getters and setters of `UIButton` have their equivalent in `PermissionButton`.\n\n```swift\nbutton.setTitles([\n    .authorized:    \"Authorized\",\n    .denied:        \"Denied\",\n    .disabled:      \"Disabled\",\n    .notDetermined: \"Not determined\"\n])\n\n\u002F\u002F button.setAttributedTitles\n\u002F\u002F button.setTitleColors\n\u002F\u002F button.setTitleShadowColors\n\u002F\u002F button.setImages\n\u002F\u002F button.setBackgroundImages\n\u002F\u002F etc.\n```\n\n#### Third-party libraries:\n\n- [sunshinejr\u002F**RxPermission**](https:\u002F\u002Fgithub.com\u002Fsunshinejr\u002FRxPermission) RxSwift bindings for Permissions API in iOS.\n\n## Example\n\n```swift\nclass PermissionsViewController: UIViewController, PermissionSetDelegate {\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        let label = UILabel()\n\n        let contacts   = PermissionButton(.contacts)\n        let camera     = PermissionButton(.camera)\n        let microphone = PermissionButton(.microphone)\n        let photos     = PermissionButton(.photos)\n\n        contacts.setTitles([\n            .notDetermined: \"Contacts - NotDetermined\"\n            .authorized:    \"Contacts - Authorized\",\n            .denied:        \"Contacts - Denied\"\n        ])\n\n        contacts.setTitleColors([\n            .notDetermined: .black,\n            .authorized:    .green,\n            .denied:        .red\n        ])\n\n        \u002F\u002F ...\n\n        let permissionSet = PermissionSet(contacts, camera, microphone, photos)\n\n        permissionSet.delegate = self\n\n        label.text = String(describing: permissionSet.status)\n\n        for subview in [label, contacts, camera, microphone, photos] {\n            view.addSubview(subview)\n        }\n    }\n\n    func permissionSet(permissionSet: PermissionSet, didRequestPermission permission: Permission) {\n        label.text = String(permissionSet.status)\n    }\n}\n```\n\n\u003Cimg align=\"center\" src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fdelba\u002FPermission\u002Fassets\u002Fpermission.gif\" \u002F>\n\n## Installation\n\n### Carthage\n\n[Carthage](https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http:\u002F\u002Fbrew.sh\u002F) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate Permission into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"delba\u002FPermission\"\n```\n\n##### Configuration\n\nDue to Apple's new policy regarding permission access, binaries may be rejected due to a perceived attempt\nto access privacy-sensitive data without a usage key, and then further rejected for not actually requesting\npermissions.\n\nAs a workaround, you can provide custom build flags _before_ building the dynamic framework to only compile\nwith permissions you request. This is done by adding a configuration file named `PermissionConfiguration.xcconfig`\nto the root of your project. For convenience, you can use\n`PermissionConfiguration.xcconfig` in the `Permission\u002F` repo directory. Just comment out the permissions\nyou want to use, and compile the framework.\n\nTo compile with only notifications and photos permissions:\n```\nPERMISSION_BLUETOOTH         = \u002F\u002F PERMISSION_BLUETOOTH\nPERMISSION_CAMERA            = PERMISSION_CAMERA\nPERMISSION_CONTACTS          = \u002F\u002F PERMISSION_CONTACTS\nPERMISSION_EVENTS            = \u002F\u002F PERMISSION_EVENTS\nPERMISSION_LOCATION          = \u002F\u002F PERMISSION_LOCATION\nPERMISSION_MICROPHONE        = \u002F\u002F PERMISSION_MICROPHONE\nPERMISSION_MOTION            = \u002F\u002F PERMISSION_MOTION\nPERMISSION_NOTIFICATIONS     = PERMISSION_NOTIFICATIONS\nPERMISSION_PHOTOS            = \u002F\u002F PERMISSION_PHOTOS\nPERMISSION_REMINDERS         = \u002F\u002F PERMISSION_REMINDERS\nPERMISSION_SPEECH_RECOGNIZER = \u002F\u002F PERMISSION_SPEECH_RECOGNIZER\nPERMISSION_MEDIA_LIBRARY     = \u002F\u002F PERMISSION_MEDIA_LIBRARY\n\n\u002F\u002F Do not modify this line. Instead, remove comments above as needed to enable the categories your app uses.\nPERMISSION_FLAGS= $(PERMISSION_BLUETOOTH) $(PERMISSION_CAMERA) $(PERMISSION_CONTACTS) $(PERMISSION_EVENTS) $(PERMISSION_LOCATION) $(PERMISSION_MICROPHONE) $(PERMISSION_MOTION) $(PERMISSION_NOTIFICATIONS) $(PERMISSION_PHOTOS) $(PERMISSION_REMINDERS) $(PERMISSION_SPEECH_RECOGNIZER) $(PERMISSION_MEDIA_LIBRARY)\n\nSWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) $(PERMISSION_FLAGS)\n```\n\n### Cocoapods\n\n[CocoaPods](http:\u002F\u002Fcocoapods.org) is a dependency manager for Cocoa projects.\n\nYou can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate Permission into your Xcode project using CocoaPods, specify it in your `Podfile`. Due to Apple's new policy regarding permission access you need to specifically define what kind of permissions you want to access using subspecs. For example if you want to access the Camera and the Notifications you define the following:\n\n```ruby\nuse_frameworks!\n\npod 'Permission\u002FCamera'\npod 'Permission\u002FNotifications'\n```\n\nPlease see `Permission.podspec` for more information about which subspecs are available.\n\n## License\n\nCopyright (c) 2015-2019 Damien (http:\u002F\u002Fdelba.io)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and\u002For sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","Permission 是一个为 iOS 平台设计的统一权限请求 API。它使用 Swift 语言开发，支持多种权限类型如蓝牙、相机、联系人等，并提供了简洁的接口来检查和请求这些权限的状态。通过 Permission 库，开发者可以轻松地在应用中集成权限管理功能，无需针对每种权限编写复杂的原生代码。该库适用于需要访问用户设备特定功能（例如定位服务或相册）的所有 iOS 应用场景，能够帮助提高开发效率并确保良好的用户体验。",2,"2026-06-11 03:10:21","top_language"]