Last active
December 9, 2016 20:06
-
-
Save RollingGoron/847f367a3b6224881e392be15ebedc47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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