NStyle 1.0.6

NStyle 1.0.6

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Nguyen Phu Nghia.



NStyle 1.0.6

  • By
  • Nghia Nguyen

NStyle 0.1

NStyle helps you reuse UI styles. It is refactored from Fashion.

CHANGE LOG

v0.1

INSTALLATION

Pod

use_frameworks!

pod 'NStyle'

USAGE

import NStyle
Create stylesheet
enum UIClass: String, NKStringConvertible {
    case TitleLabel 
    case LargeBorder

    var string: String {
        return rawValue
    }
}

struct MainStylesheet: NKStylesheet {
    func build(stylist: NKStylist) {
        stylist.registerClass(UIClass.TitleLabel) { (label: UILabel) in
            label.font = UIFont.title
            label.color = UIColor.blackColor()
        }

        stylist.registerClass(UIClass.LargeBorder) { (view: UIView) in
            view.layer.borderWidth = 4
            view.layer.borderColor = UIColor.yellowColor()
        }
    }
}
CSS.registerStylesheets(MainStylesheet())

let label = UILabel().nk_classes(UIClass.TitleLabel, UIClass.LargeBorder)