PartialStore
Helper Store type that is used as a partial type.
This type is very helpful when you want to pass the store to pieces of your application
that must be aware of the type of state that the app manages but they should not care about
the logic part (that is, the dependency container). A very common case is when you want to
pass the store to the UI of your application. The UI shouldn’t access to the dependency container
directly (it should dispatch a SideEffect
instead) but you can still have type-safety over the
state type that is managed.
Warning
you should not create this class directly. The class is meant to be used as a partial type erasure system overStore
-
Closure that is used to initialize the state
Declaration
Swift
public typealias StateInitializer<T> = () -> T where T : State
-
The current state of the application
Declaration
Swift
open fileprivate(set) var state: S { get }
-
Not implemented
Warning
Not implemented. Instantiate aStore
insteadDeclaration
Swift
@discardableResult public func anyDispatch(_: Dispatchable) -> Promise<Any>
-
Not implemented
Warning
Not implemented. Instantiate aStore
insteadDeclaration
Swift
@discardableResult public func dispatch<T>(_: T) -> Promise<Void> where T : AnyStateUpdater
-
Not implemented
Warning
Not implemented. Instantiate aStore
insteadDeclaration
Swift
@discardableResult public func dispatch<T>(_: T) -> Promise<Void> where T : AnySideEffect
-
Not implemented
Warning
Not implemented. Instantiate aStore
insteadDeclaration
Swift
@discardableResult public func dispatch<T>(_: T) -> Promise<T.ReturnValue> where T : ReturningSideEffect
-
Not implemented
Warning
Not implemented. Instantiate aStore
insteadDeclaration
Swift
public func addAnyListener(_: @escaping AnyStoreListener) -> StoreUnsubscribe
-
Adds a listener to the store. A listener is basically a closure that is invoked every time the Store’s state changes
Warning
Not implemented. Instantiate aStore
insteadDeclaration
Swift
public func addListener(_: @escaping StoreListener<S>) -> StoreUnsubscribe
Parameters
listener
the listener closure
Return Value
a closure that can be used to remove the listener