Event
public class Event<State>
Event representation class.
You need to create an instance of event and then bind on it and trigger
State is a generic parameter that specify a type of information that current event might send to listeners
-
trueif current event have at least one listenerDeclaration
Swift
public var hasListeners: Bool { get } -
Main initializer
Declaration
Swift
public init() -
Method that will trigger information notifying to all listeners
Declaration
Swift
public func trigger(with state: State)Parameters
stateAn information that needs to be send to listeners
-
Adding new listener to current event
Declaration
Swift
@discardableResult public func listen(signedBy object: AnyObject? = nil) -> Listener<State>Parameters
objectSigning object. Might be only one subscription per one object. Useful if you want to be sure that you have not subscribed several times to similar event with one object
Return Value
Listener that might be additionaly configured
-
Removing listener signed with object
Declaration
Swift
@discardableResult public func removeListener(signedBy: AnyObject) -> BoolParameters
signedBySigning object
Return Value
trueif listener was successfuly removed
Event Class Reference