Skip to content

Instantly share code, notes, and snippets.

@a2
Created February 1, 2017 13:12
Show Gist options
  • Select an option

  • Save a2/a02890af9bf4553611ed0413cf4fad06 to your computer and use it in GitHub Desktop.

Select an option

Save a2/a02890af9bf4553611ed0413cf4fad06 to your computer and use it in GitHub Desktop.
import UIKit
protocol ViewProtocol {
var view: UIView { get }
}
extension ViewProtocol where Self: UIView {
var view: UIView {
return self
}
}
extension ViewProtocol {
var backgroundColor: UIColor? {
get {
return view.backgroundColor
}
set {
view.backgroundColor = newValue
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment