Created
April 1, 2020 21:36
-
-
Save robertofrontado/11c9f3645c5781c99e3d32cb1ccc72d8 to your computer and use it in GitHub Desktop.
SwiftDI - Resolver
This file contains hidden or 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
internal enum Resolver { | |
case single(object: Any) | |
case factory(block: () -> Any) | |
func resolve() -> Any { | |
switch self { | |
case .single(let object): return object | |
case .factory(let block): return block() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment