Skip to content

Instantly share code, notes, and snippets.

@Thomvis
Last active February 1, 2017 17:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thomvis/9941fec3d6682b1de45c3475c01c98e0 to your computer and use it in GitHub Desktop.
Save Thomvis/9941fec3d6682b1de45c3475c01c98e0 to your computer and use it in GitHub Desktop.
protocol HeaderViewProtocol {
func setTitle(_ title: String)
func asUIView() -> UIView
}
extension HeaderViewProtocol where Self: UIView {
func asUIView() -> UIView {
return self
}
}
let header: HeaderViewProtocol! = MyHeaderView()
header.setTitle("Hello")
header.asUIView().removeFromSuperview()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment