Created
November 10, 2018 18:28
-
-
Save polac24/5a4a5d69435b14d782e3bf2139d60ac1 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
protocol Loader{ | |
func load(_ url: @autoclosure ()->(URL), completion: @escaping (URLResponse)->()) throws -> CancelToken | |
} | |
// Before | |
class LoaderStub: Loader { | |
var loadAction: ((@autoclosure () -> (URL), (URLResponse) -> ()) throws -> CancelToken)? | |
func load(_ url: @autoclosure...){...} | |
} | |
// After | |
class LoaderStub: Loader { | |
lazy var loadAction = asNil(load) | |
func load(_ url: @autoclosure...){...} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment