App Configuration via Plist, inspired by original DB5 library and NUI. By storing primitive values, fonts, styles for UI controls you can easily configure appearance of your app.
Add plist file to your project or copy a demo file from the demo project.
Add keys and values to your plist file
var themeLoader = DB6ThemeLoader(themeFilename: "DB6Demo")
var theme = DB6Theme.default
let stringKey = "string"
let stringValue: String? = theme?.string(key: stringKey)
let key = "integer"
let value: Int? = theme?.integer(key: key)
let key = "float"
let value: Float = theme?.float(key: key)
let key = "double"
let value: Double = theme?.double(key: key)
let key = "boolean"
let value: Bool = theme?.bool(key: key)
let key = "colorHex"
let value: UIColor = theme?.color(key: key)
The theme manager allows you to read not only values from the plist file, but also use references for another values. A reference starts with @ symbol. If the there is not such key in the dictionary the reference string will be returned.
You can style your UI controls with a dictionary in plist file. See the demo project.
You can add multiple styles in the Interface Builder. There is "style" custom attribute.
You can add multiple styles to your controll programmatically.
let style = "loginbutton"
let button = UIButton()
theme.update(button: button, key: style)
- backgroundColor
- borderWidth
- cornerRadius
- borderColor
- font
- textColor
- kern
- font
- textColor
- kern
The demo app is very simple and straightforward, it explains how the library works via some sample code and unit tests.
DB6
is available on CocoaPods.
Add the following to your Podfile
:
pod 'DB6'
DB6
is available through Carthage. To install it, simply add the following line to your Cartfile:
github "jeksys/DB6"
DB6 is available under the MIT license. See the LICENSE file for details.
- Add variables
- Add support for native plist types (Number, Boolean, Date)
- Add support for plist dictionaries
- Add support for plist arrays
- Add Cocoa pod support
- Add Swift package manager support
- Add Carthage support
- Add theme switcher
- Add more UI components
- Add RGB color support