Latest 0.1.0
Homepage https://github.com/timothycosta/TSCThemer
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

TSCThemer is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'TSCThemer'

Usage

TSCThemer has only two essential parts. A simple Themer class with a single member variable index, and an extension to NSObject.

When changing the index a notification is triggered, which executes the blocks registered via the extension.

To add a block use setTheme()

/// Sets a theme on the given object
///
/// - Parameters:
///   - themer: The Themer to use
///   - index: Corresponds to Themer.index.  Indexes need not be sequential.
///   - key: For example "TextColor", "Font", "BackgroundColor", "Layout"
///   - block: A block that will be executed when the theme updates.  Called immediately if indexes match.
public func setTheme(themer: Themer = Themer.shared, index: Int, key: String, block: ThemeBlock?)

Convenience methods are provided for common UIKit methods such as: backgroundColor, textColor, text, attributedText, etc.

self.view.themeBackgroundColor([.red, .blue])
self.button.themeTintColor([.red, .green])

Author

timothycosta, [email protected]

License

TSCThemer is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "TSCThemer",
    "version": "0.1.0",
    "summary": "A minimal themer.",
    "swift_version": "4.2",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/timothycosta/TSCThemer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "timothycosta": "[email protected]"
    },
    "source": {
        "git": "https://github.com/timothycosta/TSCThemer.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "TSCThemer/Classes/**/*"
}

Pin It on Pinterest

Share This