Created
June 1, 2018 21:54
-
-
Save vhart/d2b0812920f26ab61865b60ee77fda4e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import UIKit | |
class PermaColorView: UIView { | |
var color: UIColor = .clear { | |
didSet { | |
backgroundColor = color | |
} | |
} | |
override var backgroundColor: UIColor? { | |
set { | |
guard newValue == color else { return } | |
super.backgroundColor = newValue | |
} | |
get { | |
return super.backgroundColor | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment