Latest 1.0.0
License MIT
Platforms ios 8.0
Dependencies FreestylerCore

What is it?

Freestyler lets you define styles for your application in a single place using declarative syntax, so you can easily change colors, fonts and other visual properties across all the app.

How to use it?

  • Make label text color red:

    label <~
  • Save style to some variable:

    let redTextColor =
  • Apply style above to multiple labels:

    [label1, label2] <~ redTextColor
  • Style which makes text color green and bold font:

    let greenTextColorAndBoldFont <~ <~ UIFont.boldSystemFont(ofSize: 14.0))
    /// or 
    let greenTextColorAndBoldFont <~ [, UIFont.boldSystemFont(ofSize: 14.0))]
    /// or
    let greenTextColorAndBoldFont: Style = [, UIFont.boldSystemFont(ofSize: 14.0))]
  • Application of styles is not commutative, i.e. order matters:

    label <~ [redTextColor, greenTextColorAndBoldFont] 
    // ^ label will be green and bold
    label <~ [greenTextColorAndBoldFont, redTextColor]
    // ^ label will be red; also bold though
  • You can apply style of UIView to UILabel but not vice versa; in general, you can apply style of class to instance of subclass:

    label <~ UIColor.yellow)
    // code below will crash 🔥
    view <~
  • Using protocol Color, you can create palettes for often encountered colors in your app and give them meaningful name. It will also help to have a central place where all colors located so you can change them across all the app with one line of code:

    enum Theme: Color {
        case title
        case subtitle
        case background
        var color: UIColor {
            switch self {
            case .title: return
            case .subtitle: return UIColor.lightGray
            case .background: return UIColor.white
    // ... somewhere in code
    label <~ Theme.title)
  • Also the same thing for fonts – Font protocol:

    enum Typography: Font {
        case big
        case medium
        case small
        var font: Font {
            switch self {
            case .big: return UIFont.systemFont(ofSize: 18.0)
            case .medium: return UIFont.systemFont(ofSize: 14.0)
            case .small: return UIFont.systemFont(ofSize: 11.0)
    // ... somewhere in code
    label <~ Typography.big)


  • iOS 8.0+
  • Swift 3
  • Xcode 8.0+



  1. Install Cocoapods: sudo gem install cocoapods
  2. Create Podfile in your project directory.
  3. Add in your Podfile:

    pod 'Freestyler', '~> 1.0'
  4. Run pod install
  5. import Freestyler in your .swift files.


Carthage is currently not supported.


  1. Clone or download Freestyler
  2. Drag Freestyler folder to your project in Xcode; make sure ☑️ Copy items into destination’s group folder (if needed) option is checked.


Alexander Doloz, [email protected]


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

Latest podspec

    "name": "Freestyler",
    "version": "1.0.0",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    "homepage": "",
    "authors": {
        "Alexander Doloz": "[email protected]"
    "summary": "Swift 3 framework for styling + big set of styles for builtin UIView subclasses",
    "description": "Freestyler provides styles and protocols so you can perform theming of your application with ease.",
    "source": {
        "git": "",
        "tag": "1.0.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "Freestyler/**/*.swift",
    "ios": {
        "frameworks": "UIKit"
    "dependencies": {
        "FreestylerCore": [
            "~> 1.0.1"
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This