Michael Long
1 min readOct 20, 2019

--

Depends on the Dependency Injection system. In Resolver, you’d register the service in the .application scope.

register { MyService() }.scope(application)

Resolver would then resolve it the first time it’s needed but cache the result such that any further resolutions will get the same object.

In Swinject, it would be the .container scope.

For more, see Resolver: Scopes.

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

No responses yet