Skip to content

Instantly share code, notes, and snippets.

@patchthecode
Created July 16, 2016 07:15
Show Gist options
  • Save patchthecode/86360eae735136fadfde6e5c622f138d to your computer and use it in GitHub Desktop.
Save patchthecode/86360eae735136fadfde6e5c622f138d to your computer and use it in GitHub Desktop.
generics
class class1 {
var view: viewSubclass1!
func printName() {
print("This is the view: \(view)")
}
}
class class2 {
var view: viewSubclass2!
func printName() {
print("This is the view: \(view)")
}
}
protocol myProtocol {
var view: UIView {get set}
func printName()
}
extension myProtocol {
func printName() {
print("This is the view: \(view)")
}
}
class viewSubclass1: UIView {
}
class viewSubclass2: UIView {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment