0001 /** 0002 This protocol is used when you want to do some async behavior that updates the 0003 store. It is very minimal in that it's not allowed to modify the store 0004 directly. The async behavior is done within the `call` method and to make 0005 changes it should dispatch a synchronous action. 0006 0007 Sample Action: 0008 0009 ```swift 0010 struct FetchUsers: DynamicActionType { 0011 func call() { 0012 someApi.fetchUsers { users in 0013 store.dispatch(SetUsersAction(users: users)) 0014 } 0015 } 0016 } 0017 0018 store.dispatch(UpdateIdAction(id: 1)) 0019 ``` 0020 */ 0021 public protocol DynamicActionType{ 0022 /** 0023 The return type from the `call` method. 0024 0025 - note: This is inferred from the `call` method implementation. 0026 */ 0027 typealias ResponseType
Store.swift:45 func dispatch<DynamicAction: DynamicActionType>(action: DynamicAction) -> DynamicAction.ResponseTypeStore.swift:60 public func dispatch<DynamicAction: DynamicActionType>(action: DynamicAction) -> DynamicAction.ResponseType {0028 0029 /** 0030 This method is where you perform some async behavior that when completed, 0031 should dispatch a synchronous action on the store. 0032 0033 You can optionally return an object that wraps async behavior. This might 0034 be a `Promise` from PromiseKit or `SignalProducer` from ReactiveCocoa. 0035 */ 0036 func call
DynamicAction.swift:36 func call() -> ResponseTypeStore.swift:45 func dispatch<DynamicAction: DynamicActionType>(action: DynamicAction) -> DynamicAction.ResponseTypeStore.swift:60 public func dispatch<DynamicAction: DynamicActionType>(action: DynamicAction) -> DynamicAction.ResponseType {() -> ResponseType 0037 } 0038
Store.swift:61 return action.call()