StateSelector

@ObjCName(name = "StateSelector")
open class StateSelector<S : ModuleState>(source)

Generic state selector for Swift/iOS. Wraps KClass internally so Swift doesn't need to deal with it.

Example from Swift:

let selector = CounterModule.shared.stateSelector
let stateFlow = await selector.select(store: store)

for await state in stateFlow {
print("Count: \(state.count)")
}

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun getValue(store: Store): S

Get the current state value.

Link copied to clipboard
suspend fun select(store: Store): StateFlow<S>

Select state from store (suspending).

Link copied to clipboard
fun selectNow(store: Store): StateFlow<S>

Select state from store (non-suspending).