Latest 2.0.0
Homepage https://github.com/Digipolitan/monet
License BSD
Platforms ios 8.0, tvos 9.0
Dependencies ObjectMapper

Swift Version
Build Status
CocoaPods Compatible
Carthage Compatible
Platform
Twitter

Theme manager, to simplify applications appearences.

Installation

CocoaPods

To install Monet with CocoaPods, add the following lines to your Podfile.

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod 'Monet'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Monet into your Xcode project using Carthage, specify it in your Cartfile:

github 'Digipolitan/monet' ~> 2.0

Run carthage update to build the framework and drag the built Monet.framework into your Xcode project.

The Basics

You need to create your theme template in json.
On this example we create default.json which correspond to the default template of the app.

{
    "identifier": "com.digipolitan.theme.default",
    "@colors": {
        "primary": "#FF877F"
    },
    "@fonts": {
        "regular-body": {
            "name": "Optima-Regular",
            "size": 48
        },
        "bold-action": {
            "name": "Optima-Bold",
            "size": 15
        }
    },
    "appearances": {
        "views": {
            "scene" : {
                "backgroundColor": "#123456"
            }
        },
        "texts": {
            "body": {
                "backgroundColor": "@colors/primary",
                "foregroundColor": "#323233",
                "font": "@fonts/regular-body"
            },
            "action": {
                "backgroundColor": "@colors/primary",
                "foregroundColor": "#FFFFFF",
                "font": "@fonts/bold-action"
            }
        }
    }
}

Then you can set your default theme like following

Monet.shared.theme = try? Theme.from(jsonFile: "default")

Then you can just set all the appearence of your app like following

self.label.setAppearance(theme.appearances.texts["body"])
self.view.setAppearance(theme.appearances.views["scene"])

Now it’s possible to setup appearance in the InterfaceBuilder with the dynamic key appearanceIdentifier for each UIView subclasses

Contributing

See CONTRIBUTING.md for more details!

This project adheres to the Contributor Covenant Code of Conduct.
By participating, you are expected to uphold this code. Please report
unacceptable behavior to [email protected].

License

Monet is licensed under the BSD 3-Clause license.

Latest podspec

{
    "name": "Monet",
    "version": "2.0.0",
    "summary": "Theme manager to simplify app appearences",
    "homepage": "https://github.com/Digipolitan/monet",
    "authors": "Digipolitan",
    "source": {
        "git": "https://github.com/Digipolitan/monet.git",
        "tag": "v2.0.0"
    },
    "license": {
        "type": "BSD",
        "file": "LICENSE"
    },
    "source_files": "Sources/**/*.{swift,h}",
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "swift_version": "4.2",
    "dependencies": {
        "ObjectMapper": [
            "~> 3.4"
        ]
    }
}

Pin It on Pinterest

Share This