Once
Once is an object that will perform exactly one action.
-
Returns a new Once.
Declaration
Swift
public init() {} -
Calls the
actionif and only ifdoitis being called for the first time for this instance ofOnce. In other words, givenvar once OnceIf
doitis called multiple times, only the first call will invokeaction, even ifactionhas a different value in each invocation. A new instance ofOnceis required for each function to execute.This method is intended for initialization that must be run exactly once.
Declaration
Swift
public func doit(action: ()->())
View on GitHub
Once Class Reference