Skip to content

Instantly share code, notes, and snippets.

@RollingGoron
Last active December 9, 2016 20:06
Show Gist options
  • Save RollingGoron/847f367a3b6224881e392be15ebedc47 to your computer and use it in GitHub Desktop.
Save RollingGoron/847f367a3b6224881e392be15ebedc47 to your computer and use it in GitHub Desktop.
//
// SCLabel.swift
// SwiftCast
//
// Created by Peter Gosling on 12/7/16.
// Copyright © 2016 SunfireSoft. All rights reserved.
//
import UIKit
class TCLabel: UILabel {
private var appearanceModel : AppearanceProtocol?
var style : AppearanceEnum {
didSet {
self.appearanceModel = AppearanceManager.fetchStyleFor(style: style)
self.didSetStyle()
}
}
required init?(coder aDecoder: NSCoder) {
self.style = .normal
super.init(coder: aDecoder)
}
init(style : AppearanceEnum, text : String?, frame : CGRect) {
self.style = style
super.init(frame : frame)
self.text = text
}
func didSetStyle() {
if let appearanceModel = self.appearanceModel {
self.textColor = appearanceModel.color
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment