Latest 4.2.0
Homepage https://github.com/CrossWaterBridge/Theme
License MIT
Platforms ios 9.0, tvos 10.0, requires ARC
Dependencies ObserverSet
Authors ,

Pod Version
Pod License
Pod Platform

Support one or more configurable appearance themes.

Installation

Install with CocoaPods by adding the following to your Podfile:

use_frameworks!

pod 'Theme'

Then run:

pod install

Usage

Create a plist for your themes.

Register the plist when your app launches:

import Theme

func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
    let themePath = NSBundle.mainBundle().pathForResource("Theme", ofType: "plist")
    let themeDictionary = NSDictionary(contentsOfFile: themePath!)
    ThemeController.sharedController.registerThemes(themeDictionary!)

    ...
}

Set the initial theme when your app launches, and change the theme whenever you choose.

Observe changes to the theme from any view, view controller, or other object:

import Theme

class ThemeAwareTableView: UITableView {
    override init(frame: CGRect, style: UITableViewStyle) {
        super.init(frame: frame, style: style)

        observeTheme(self.dynamicType.themeDidChange)
    }

    func themeDidChange(theme: Theme) {
        separatorColor = theme.colorForKeyPath("tableView.separatorColor")
        backgroundColor = theme.colorForKeyPath("tableView.backgroundColor")
    }

    ...   
}

License

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

Latest podspec

{
    "name": "Theme",
    "version": "4.2.0",
    "summary": "Support one or more configurable appearance themes.",
    "authors": [
        "Hilton Campbell",
        "Stephan Heilner"
    ],
    "homepage": "https://github.com/CrossWaterBridge/Theme",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "source": {
        "git": "https://github.com/CrossWaterBridge/Theme.git",
        "tag": "4.2.0"
    },
    "platforms": {
        "ios": "9.0",
        "tvos": "10.0"
    },
    "source_files": "Theme/*.swift",
    "requires_arc": true,
    "dependencies": {
        "ObserverSet": []
    }
}

Pin It on Pinterest

Share This