{"id":1791,"url":"https://github.com/nixzhu/Proposer","last_synced_at":"2025-08-02T04:32:25.650Z","repository":{"id":1069761,"uuid":"38894137","full_name":"nixzhu/Proposer","owner":"nixzhu","description":"Make permission request easier.","archived":false,"fork":false,"pushed_at":"2021-12-17T07:06:46.000Z","size":67,"stargazers_count":852,"open_issues_count":3,"forks_count":46,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-07-27T20:22:45.135Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nixzhu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-10T17:51:00.000Z","updated_at":"2025-03-11T13:09:27.000Z","dependencies_parsed_at":"2022-11-28T10:33:46.987Z","dependency_job_id":null,"html_url":"https://github.com/nixzhu/Proposer","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/nixzhu/Proposer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixzhu%2FProposer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixzhu%2FProposer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixzhu%2FProposer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixzhu%2FProposer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nixzhu","download_url":"https://codeload.github.com/nixzhu/Proposer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixzhu%2FProposer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334617,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:55.891Z","updated_at":"2025-08-02T04:32:25.417Z","avatar_url":"https://github.com/nixzhu.png","language":"Swift","funding_links":[],"categories":["Permissions","Swift"],"sub_categories":["Other Parsing","Other free courses"],"readme":"\u003cp\u003e\n\u003ca href=\"http://cocoadocs.org/docsets/Proposer\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/Proposer.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Carthage/Carthage/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Proposer\n\nProposer provides a single API to request permission for access **Camera**, **Photos**, **Microphone**, **Contacts**, **Reminders**, **Calendar**, **Location** or **Notifications**.\n\n## Requirements\n\nSwift 4.2, iOS 9.0\n\n(Swift 3, use version 1.1.0)\n\n## Example\n\nOnly one single API:\n\n```swift\nproposeToAccess(_:agreed:rejected:)\n```\n\nIn real world:\n\n```swift\nimport Proposer\n```\n\n```swift\n@IBAction func choosePhoto() {\n    let photos: PrivateResource = .photos\n    let propose: Propose = {\n        proposeToAccess(photos, agreed: {\n            print(\"I can access Photos. :]\\n\")\n            if UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum) {\n                let imagePicker = UIImagePickerController()\n                imagePicker.sourceType = .savedPhotosAlbum\n                self.present(imagePicker, animated: true, completion: nil)\n            }\n        }, rejected: {\n            self.alertNoPermissionToAccess(photos)\n        })\n    }\n    showProposeMessageIfNeedFor(photos, andTryPropose: propose)\n}\n```\n\nWhen you want to get user's location, thanks to Swift's enum, you can even choose the usage mode:\n\n```swift\n@IBAction func shareLocation() {\n    let location: PrivateResource = .location(.whenInUse)\n    let propose: Propose = {\n        proposeToAccess(location, agreed: {\n            print(\"I can access Location. :]\\n\")\n        }, rejected: {\n            self.alertNoPermissionToAccess(location)\n        })\n    }\n    showProposeMessageIfNeedFor(location, andTryPropose: propose)\n}\n```\n\nDepending on your needs, you must add a `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` to your Info.plist\n\nSee the demo for more information.\n\nI recommend you add a `UIViewController+Proposer.swift` file (like the demo) for show localized alert before the first proposal or when propose failed.\n\n## Installation\n\nFeel free to drag `Proposer.swift` to your iOS Project. But it's recommended to use Carthage (or CocoaPods).\n\n### Carthage\n\n```ogdl\ngithub \"nixzhu/Proposer\"\n```\n\n#### CocoaPods\n\n```ruby\npod 'Proposer'\n```\n\n# Contact\n\nNIX [@nixzhu](https://twitter.com/nixzhu)\n\n## License\n\nProposer is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixzhu%2FProposer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnixzhu%2FProposer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixzhu%2FProposer/lists"}