Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/DB6Public

App Configuration via Plist, inspired by the original DB5 library

License

NotificationsYou must be signed in to change notification settings

jeksys/DB6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LicensePlatformSwift 3.xBlogMadeWithLove

App Configuration via Plist, inspired by originalDB5 library andNUI. By storing primitive values, fonts, styles for UI controls you can easily configure appearance of your app.

Usage

1. Create Plist

Add plist file to your project or copy a demo file from the demo project.

2. Define your plist keys

Add keys and values to your plist file

3. Initialize theme manager

varthemeLoader=DB6ThemeLoader(themeFilename:"DB6Demo")vartheme=DB6Theme.default

4. Read primitive values

letstringKey="string"letstringValue:String?= theme?.string(key: stringKey)letkey="integer"letvalue:Int?= theme?.integer(key: key)letkey="float"letvalue:Float= theme?.float(key: key)letkey="double"letvalue:Double= theme?.double(key: key)letkey="boolean"letvalue:Bool= theme?.bool(key: key)letkey="colorHex"letvalue:UIColor= theme?.color(key: key)

Read values by reference

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.

Style your UI controls.

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.

letstyle="loginbutton"letbutton=UIButton()theme.update(button: button, key: style)

Supported UI controls and attributes

1. UIView

  • backgroundColor
  • borderWidth
  • cornerRadius
  • borderColor

2. UILabel

  • font
  • textColor
  • kern

3. UIButton

  • font
  • textColor
  • kern

Demo App

The demo app is very simple and straightforward, it explains how the library works via some sample code and unit tests.

Installation

CocoaPods

DB6 is available on CocoaPods.Add the following to yourPodfile:

pod 'DB6'

Carthage - not available yet

DB6 is available throughCarthage. To install it, simply add the following line to your Cartfile:

github"jeksys/DB6"

License

DB6 is available under the MIT license. See the LICENSE file for details.

TODO

  • 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

About

App Configuration via Plist, inspired by the original DB5 library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp