Skip to content

Instantly share code, notes, and snippets.

@Cananito
Last active August 29, 2015 14:21
Show Gist options
  • Save Cananito/f06987c90d05979f206a to your computer and use it in GitHub Desktop.
Save Cananito/f06987c90d05979f206a to your computer and use it in GitHub Desktop.
Protocol Property Subclassing.
import UIKit
class ViewA: UIView {
}
class ViewB: UIView {
}
protocol ViewController: class {
typealias View: UIView
var view: View { get }
}
class ViewControllerA: ViewController {
var view: ViewA {
get {
return ViewA()
}
}
}
class ViewControllerB: ViewController {
var view: ViewB {
get {
return ViewB()
}
}
}
@Cananito
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment