All Projects → nmdias → Infokit

nmdias / Infokit

Licence: mit
Strongly Typed access to the Info.plist for iOS, macOS and tvOS.

Programming Languages

swift
15916 projects
swift4
162 projects

Projects that are alternatives of or similar to Infokit

L10n Swift
Localization of the application with ability to change language "on the fly" and support for plural form in any language.
Stars: ✭ 177 (-35.87%)
Mutual labels:  plist, tvos
Fontblaster
Programmatically load custom fonts into your iOS and tvOS app.
Stars: ✭ 1,000 (+262.32%)
Mutual labels:  plist, tvos
SwiftVer
Easily Manage Versioning in MacOS, iOS, watchOS, and tvOS projects.
Stars: ✭ 23 (-91.67%)
Mutual labels:  tvos, plist
Licensegenerator Ios
Build script that recursively searches for LICENSE files and generates a Settings.bundle friendly plist.
Stars: ✭ 186 (-32.61%)
Mutual labels:  plist, tvos
Datez
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!
Stars: ✭ 254 (-7.97%)
Mutual labels:  tvos
WebPKit
A framework that extends a variety of Cocoa APIs with capabilities for encoding and decoding WebP files for all of Apple's platforms.
Stars: ✭ 29 (-89.49%)
Mutual labels:  tvos
tvheadend-ios-lib
Tvheadend iOS library enables you to create apps that connect to tvheadend. This is the base of TvhClient
Stars: ✭ 16 (-94.2%)
Mutual labels:  tvos
SMJJSONPath
JSONPath implementation in Objective-C
Stars: ✭ 28 (-89.86%)
Mutual labels:  tvos
Swiftui Charts
🚀 SwiftUI Charts with custom styles
Stars: ✭ 272 (-1.45%)
Mutual labels:  tvos
Wechat tweak
♨️ iOS版功能最全的微信插件,支持最新版微信,具备自动抢红包,屏蔽消息和群消息,过滤特定的群聊,防止撤回消息,伪定位 (朋友圈和附近的人),修改微信运动步数和实时取景做聊天页的背景等功能。
Stars: ✭ 265 (-3.99%)
Mutual labels:  plist
SwiftGenStrings
genstrings replacement for Swift that actually works
Stars: ✭ 29 (-89.49%)
Mutual labels:  tvos
ichat2json
Reads an .ichat binary plist file and writes newline-separated JSON to STDOUT
Stars: ✭ 30 (-89.13%)
Mutual labels:  plist
Matebookxpro Hackintosh
Hackintosh Solution for the Huawei Matebook X Pro
Stars: ✭ 257 (-6.88%)
Mutual labels:  plist
moe.TV
watch bangumi on your tvOS
Stars: ✭ 25 (-90.94%)
Mutual labels:  tvos
Xestimonitors
An extensible monitoring framework written in Swift
Stars: ✭ 269 (-2.54%)
Mutual labels:  tvos
Invalidating
Backports the new @invalidating property wrapper to older platforms
Stars: ✭ 53 (-80.8%)
Mutual labels:  tvos
Atvjs
Blazing fast Apple TV application development using pure JavaScript
Stars: ✭ 262 (-5.07%)
Mutual labels:  tvos
NppBplistPlugin
Notepad++ binary plist plugin
Stars: ✭ 22 (-92.03%)
Mutual labels:  plist
clevertap-ios-sdk
CleverTap iOS SDK
Stars: ✭ 39 (-85.87%)
Mutual labels:  tvos
mcloud
Mobile farm ecosystem for Android and iOS devices
Stars: ✭ 32 (-88.41%)
Mutual labels:  tvos

InfoKit

cocoapods compatible carthage compatible language swift

简体中文

InfoKit provides Strongly Typed access to the Info.plist with less than 60 lines of code, while leveraging Swift 4's powerful Codable capabilities.

Installation >> instructions <<

Usage

Define a Codable with the properties you wish to access from the project's bundle Info.plist file.

struct Info: Codable {
    let baseUrl: String
    let staticUrl: String
}

And read the Info.plist into the Info struct:

// Define a Plist
let plist = Plist<Info>()

// Decode it
let info = plist.decode()

// Then access it's properties
info?.baseUrl    // http://debug.InfoKit.local
info?.staticUrl  // http://debug.static.InfoKit.local

Custom .plist

For 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.

struct Products: Codable {
    let foo: String
    let bar: String
}

Define a Plist, and this time, specify the resource name. e.g. ProductIDs

let plist = Plist<Products>("ProductIDs") // Reads `ProductIDs.plist`
let products = plist.decode()

products?.foo // com.InfoKit.foo
products?.bar // com.InfoKit.bar

Remember, user provided property lists must be copied into the bundle, so make sure to set it's Target Membership.

Specify a Bundle

InfoKit will default to the Main Bundle, however, you can specify the bundle, if needed:

Plist<Products>("ProductIDs", in: bundle)

Build Configurations

If no resource or bundle is specified in the initializer of the Plist class, like so:

Plist<Info>()

...then, InfoKit will default to the Main Bundle's Info.plist file defined in the Project's Build Settings.

Because of this, you can provide multiple Info.plist files for different configurations and still get the desired results. See the iOS Example project in action by choosing between the debug, staging and release configurations.

License

InfoKit is released under the MIT license. See LICENSE for details.

Help Wanted

Review/Translate README.zh-CN.md to Chinese

Chinese 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

Thank you 🙏

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].