Skip to content

Instantly share code, notes, and snippets.

@kongtomorrow
Created January 11, 2015 00:39
Show Gist options
  • Save kongtomorrow/43f4b319a2f14c5fe48f to your computer and use it in GitHub Desktop.
Save kongtomorrow/43f4b319a2f14c5fe48f to your computer and use it in GitHub Desktop.
protocol and class
import Cocoa
protocol MyProtocol {
func myFunc()
}
class MyView : NSView, MyProtocol {
func myFunc() {
}
}
func takeVConformingToViewAndProtocol<T: NSView where T : MyProtocol>(v:T) {
v.myFunc()
println(v.subviews)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment