getModule

open override fun <M : Any> getModule(moduleClass: KClass<M>): M?(source)

Get a module instance by its class.

Use this when the module type is only known at runtime (e.g. dynamic plugin systems, middleware, debug tooling). When the type is known at compile time, prefer the reified overload getModule or getRegisteredModules for Swift/Obj-C interop.

Example usage:

val navModule = storeAccessor.getModule(NavigationModule::class)
?: error("NavigationModule not registered")

Return

The module instance if registered, null otherwise

Parameters

moduleClass

The KClass of the module to retrieve

See also

reified overload for compile-time known types

for Swift/Obj-C interop