Skip to content
Norman Basham edited this page Feb 17, 2020 · 2 revisions

Bundle

Source


Provides easy access to strings in Info.plist.

Usage:

Bundle.main["appColors"]

In tests:

Bundle(for: type(of: self))["key"]

With convenient accessors e.g.:

Bundle.main.appName // Cryptogram

Bundle.main.appNameAndVersion // Cryptogram 1.0.23

Bundle.main.version // 1.0

Bundle.main.buildNumber // 23

Bundle.main.fullVersion // 1.0.23

With a list of strings e.g.:

Given Bundle.main["appColors"] with value: e84eae,8e45b9,f19433,fbde42,68cb6a,2879ca

let colors: [UIColor] = Bundle.main.parseCSV(key: "appColors") { UIColor(hex: $0) }

Clone this wiki locally