Created
March 27, 2017 16:55
-
-
Save JohnSundell/d51573acb11e555dee865b80572f14dd to your computer and use it in GitHub Desktop.
Code sample #6 from https://medium.com/@johnsundell/type-erasure-using-closures-in-swift-1e6125231f8
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
class ViewController: UIViewController { | |
private let modelLoader: AnyModelLoader<MyModel> | |
init<T: ModelLoading>(modelLoader: T) where T.Model == MyModel { | |
self.modelLoader = AnyModelLoader(loader: modelLoader) | |
super.init(nibName: nil, bundle: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment