Created
March 27, 2017 16:56
-
-
Save JohnSundell/4d08c465b81f78345c9f1bdef6406176 to your computer and use it in GitHub Desktop.
Code sample #7 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 loadModel: ((Result<MyModel>) -> Void) -> Void | |
init<T: ModelLoading>(modelLoader: T) where T.Model == MyModel { | |
loadModel = modelLoader.load | |
super.init(nibName: nil, bundle: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment