{"id":15038085,"url":"https://github.com/nmdias/infokit","last_synced_at":"2025-05-08T23:29:21.698Z","repository":{"id":56915478,"uuid":"104643893","full_name":"nmdias/InfoKit","owner":"nmdias","description":"Strongly Typed access to the Info.plist for iOS, macOS and tvOS.","archived":false,"fork":false,"pushed_at":"2019-08-11T07:41:41.000Z","size":41,"stargazers_count":280,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T02:02:35.789Z","etag":null,"topics":["ios","macos","plist","plist-files","swift","swift4","tvos"],"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/nmdias.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":"2017-09-24T12:57:17.000Z","updated_at":"2024-10-22T11:50:08.000Z","dependencies_parsed_at":"2022-08-21T03:50:37.339Z","dependency_job_id":null,"html_url":"https://github.com/nmdias/InfoKit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmdias%2FInfoKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmdias%2FInfoKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmdias%2FInfoKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmdias%2FInfoKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmdias","download_url":"https://codeload.github.com/nmdias/InfoKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253162876,"owners_count":21863992,"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","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":["ios","macos","plist","plist-files","swift","swift4","tvos"],"created_at":"2024-09-24T20:37:01.776Z","updated_at":"2025-05-08T23:29:21.674Z","avatar_url":"https://github.com/nmdias.png","language":"Swift","readme":"\n![InfoKit](/InfoKit.png?raw=true)\n\n[![cocoapods compatible](https://img.shields.io/badge/cocoapods-compatible-brightgreen.svg)](https://cocoapods.org/pods/InfoKit)\n[![carthage compatible](https://img.shields.io/badge/carthage-compatible-brightgreen.svg)](https://github.com/Carthage/Carthage)\n[![language](https://img.shields.io/badge/spm-compatible-brightgreen.svg)](https://swift.org)\n[![swift](https://img.shields.io/badge/swift-4-orange.svg)](https://github.com/nmdias/InfoKit/releases)\n\n[简体中文](README.zh-CN.md)\n\nInfoKit provides **Strongly Typed** access to the **Info.plist** with less than 60 lines of code, while leveraging **Swift 4**'s powerful [Codable](https://developer.apple.com/documentation/swift/codable) capabilities.\n\nInstallation \u003e\u003e [`instructions`](https://github.com/nmdias/InfoKit/blob/master/INSTALL.md) \u003c\u003c\n\n## Usage\n\nDefine a [Codable](https://developer.apple.com/documentation/swift/codable) with the properties you wish to access from the project's bundle **Info.plist** file.\n\n```swift\nstruct Info: Codable {\n    let baseUrl: String\n    let staticUrl: String\n}\n```\n\nAnd read the Info.plist into the `Info` struct:\n```swift\n// Define a Plist\nlet plist = Plist\u003cInfo\u003e()\n\n// Decode it\nlet info = plist.decode()\n\n// Then access it's properties\ninfo?.baseUrl    // http://debug.InfoKit.local\ninfo?.staticUrl  // http://debug.static.InfoKit.local\n```\n\n### Custom .plist\nFor convenience, `InfoKit` will also provide access to custom .plist files. Let's say you included a **ProductIDs.plist** file. Start by defining the struct with it's respective properties.\n\n```swift\nstruct Products: Codable {\n    let foo: String\n    let bar: String\n}\n```\n\nDefine a `Plist`, and this time, **specify the resource name**. e.g. `ProductIDs`\n\n```swift\nlet plist = Plist\u003cProducts\u003e(\"ProductIDs\") // Reads `ProductIDs.plist`\nlet products = plist.decode()\n\nproducts?.foo // com.InfoKit.foo\nproducts?.bar // com.InfoKit.bar\n\n```\n\n\u003e Remember, user provided property lists must be copied into the bundle, so make sure to set it's `Target Membership`.\n\n### Specify a Bundle\nInfoKit will default to the [Main Bundle](https://developer.apple.com/documentation/foundation/bundle/1410786-main), however, you can **specify the bundle**, if needed:\n\n```swift\nPlist\u003cProducts\u003e(\"ProductIDs\", in: bundle)\n```\n\n### Build Configurations\nIf **no resource or bundle is specified** in the initializer of the `Plist` class, like so:\n\n```swift\nPlist\u003cInfo\u003e()\n```\n\n...then, `InfoKit` will default to the Main Bundle's Info.plist file defined in the Project's Build Settings.\n\nBecause of this, you can provide **multiple Info.plist** files for **different configurations** and still get the desired results. \nSee the iOS Example project in action by choosing between the **debug**, **staging** and **release** configurations.\n\n## License\n\nInfoKit is released under the MIT license. See [LICENSE](https://github.com/nmdias/InfoKit/blob/master/LICENSE) for details.\n\n### Help Wanted\n#### Review/Translate [README.zh-CN.md](README.zh-CN.md) to Chinese\nChinese is the #1 spoken language in the world and I'd love to have InfoKit be more inclusive, unfortunately I don't speak Chinese. If you know chinese, and would like to help out, please see [issue #1](https://github.com/nmdias/InfoKit/issues/1)\n\nThank you 🙏\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmdias%2Finfokit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmdias%2Finfokit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmdias%2Finfokit/lists"}