Skip to content

Instantly share code, notes, and snippets.

@vhart
Created June 1, 2018 21:54
Show Gist options
  • Save vhart/d2b0812920f26ab61865b60ee77fda4e to your computer and use it in GitHub Desktop.
Save vhart/d2b0812920f26ab61865b60ee77fda4e to your computer and use it in GitHub Desktop.
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