Created
January 26, 2015 08:21
-
-
Save chakrit/7ba69fa2b714ebb25989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class Model { | |
func action() { | |
genericPrint(self.dynamicType.self, self) | |
} | |
} | |
class Child: Model { | |
func indirect() { | |
action() | |
} | |
} | |
func genericPrint<T: Model>(type: T.Type, input: T) -> T? { | |
dump(NSStringFromClass(type)) | |
dump(NSStringFromClass(T)) | |
return input | |
} | |
Child().indirect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment