Package-level declarations

Types

Link copied to clipboard

Holds the pre-configured, application-wide SimpleServiceLocator instance.

Link copied to clipboard
@VisibleForTesting
interface MockFactory

An interface for integrating a mocking library with the TestServiceLocator.

Link copied to clipboard
@RestrictTo(value = [RestrictTo.Scope.LIBRARY])
class ServiceLocatorInitializer : Initializer<SimpleServiceLocator<ServiceLocatorScope>>

An Initializer that automatically registers a production MainServiceLocator on app startup using the androidx.startup library.

Link copied to clipboard

Defines the environments for the simple-scaffold.

Link copied to clipboard
@VisibleForTesting
object TestServiceLocator

An object for setting up the test environment when using the simple-scaffold.

Functions

Link copied to clipboard
inline fun <T : Any> SimpleServiceLocator<ServiceLocatorScope>.getOrProvide(threadSafetyMode: LazyThreadSafetyMode = defaultThreadSafetyMode, noinline provider: (ServiceLocatorScope) -> T): T

Fetches the singleton instance for the reified type T.

Link copied to clipboard
inline fun <T : Any> serviceLocator(noinline allowedScopes: (ServiceLocatorScope) -> Boolean = { it == ServiceLocatorScope.Production }, threadSafetyMode: LazyThreadSafetyMode = MainServiceLocator.instance.defaultThreadSafetyMode, noinline provider: (ServiceLocatorScope) -> T): ReadOnlyProperty<Any, T>

Creates a property delegate for lazily retrieving a service from the MainServiceLocator.