Skip to content

Instantly share code, notes, and snippets.

@LizzieStudeneer
Last active January 15, 2019 10:48
Show Gist options
  • Save LizzieStudeneer/2c484522a9a7afe570ff54364665df51 to your computer and use it in GitHub Desktop.
Save LizzieStudeneer/2c484522a9a7afe570ff54364665df51 to your computer and use it in GitHub Desktop.
// MARK: Resolver
func resolve<ServiceType>(_ type: ServiceType.Type) -> ServiceType {
guard let factory = factories.first(where: { $0.supports(type) }) else {
fatalError("No suitable factory found")
}
return factory.resolve(self)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment