ActionSource
public struct ActionSource : Codable, Hashable
Representation of the entity responsible for creating and dispatching the action, including information useful for logging, debugging, analytics
or monitoring. The action source will be implicitly created when ActionHandler.dispatch is called from a middleware, view or presenter, and
it will contain the file, function and line from where the dispatch function was called. Additionally you can append extra information useful
for debugging, as an optional String attached to the ActionSource.
The Action Source will arrive at every middleware’s handle function, and you have the opportunity to use this information when performing side-
effects, such as printing logs.
-
File that created and dispatched the action
Declaration
Swift
public let file: String -
Function that created and dispatched the action
Declaration
Swift
public let function: String -
Line in the file where the action was created and dispatched
Declaration
Swift
public let line: UInt -
Additional information about the moment where the action was dispatched. This is an optional String that can hold information useful for debugging, logging, monitoring or analytics.
Declaration
Swift
public let info: String? -
Creates a structure that holds information about the entity who created and dispatched the action.
Declaration
Swift
public init(file: String, function: String, line: UInt, info: String?)Parameters
fileFile that created and dispatched the action
functionFunction that created and dispatched the action
lineLine in the file where the action was created and dispatched
infoAdditional information about the moment where the action was dispatched. This is an optional String that can hold information useful for debugging, logging, monitoring or analytics.
-
Undocumented
Declaration
Swift
public static func here(file: String = #file, function: String = #function, line: UInt = #line, info: String? = nil) -> ActionSource
View on GitHub
ActionSource Structure Reference