Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnSundell/bcdb4fd5767c74757f1a99fc123e6ef3 to your computer and use it in GitHub Desktop.
Save JohnSundell/bcdb4fd5767c74757f1a99fc123e6ef3 to your computer and use it in GitHub Desktop.
class AnyModelLoader<T>: ModelLoading {
typealias CompletionHandler = (Result<T>) -> Void
private let loadingClosure: (CompletionHandler) -> Void
init<L: ModelLoading>(loader: L) where L.Model == T {
loadingClosure = loader.load
}
func load(completionHandler: CompletionHandler) {
loadingClosure(completionHandler)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment