Skip to content

Instantly share code, notes, and snippets.

@robertofrontado
Created April 1, 2020 21:36
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 robertofrontado/11c9f3645c5781c99e3d32cb1ccc72d8 to your computer and use it in GitHub Desktop.
Save robertofrontado/11c9f3645c5781c99e3d32cb1ccc72d8 to your computer and use it in GitHub Desktop.
SwiftDI - Resolver
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