StoreType

Defines the interface of Stores in ReSwift. Store is the default implementation of this
interface. Applications have a single store that stores the entire application state.
Stores receive actions and use reducers combined with these actions, to calculate state changes.
Upon every state update a store informs all of its subscribers.

Declaration

Parameters

Dispatches an action creator to the store. Action creators are functions that generate
actions. They are called by the store and receive the current state of the application
and a reference to the store as their input.

Based on that input the action creator can either return an action or not. Alternatively
the action creator can also perform an asynchronous operation and dispatch a new action
at the end of it.

Example of an action creator:

funcdeleteNote(noteID:Int)->ActionCreator{return{state,storein// only delete note if editing is enabledif(state.editingEnabled==true){returnNoteDataAction.DeleteNote(noteID)}else{returnnil}}}

Declaration

Dispatches an async action creator to the store. An async action creator generates an
action creator asynchronously. Use this method if you want to wait for the state change
triggered by the asynchronously generated action creator.

This overloaded version of dispatch calls the provided callback as soon as the
asynchronoously dispatched action has caused a new state calculation.

Note

If the ActionCreator does not dispatch an action, the callback block will never
be called

Declaration

An optional callback that can be passed to the dispatch method.
This callback will be called when the dispatched action triggers a new state calculation.
This is useful when you need to wait on a state change, triggered by an action (e.g. wait on
a successful login). However, you should try to use this callback very seldom as it
deviates slighlty from the unidirectional data flow principal.