Functions
The following functions are available globally.
-
A utility function for creating lazily-constructed associated properties
Note
Original Source: Colin Eberhart’s
Reactive Twitter Search
Declaration
Swift
public func lazyAssociatedProperty<T: AnyObject>(host: AnyObject, key: UnsafePointer<Void>, factory: ()->T) -> T
Parameters
host
The object the property is to be associated with.
key
The address of the key this value is associated with.
factory
Closure defining the initial value.
-
Lazily-constructed associated property for a ReactiveCocoa
MutableProperty
of a given type.Note
Original Source: Colin Eberhart’s
Reactive Twitter Search
Declaration
Swift
public func lazyMutableProperty<T>(host: AnyObject, key: UnsafePointer<Void>, setter: T -> (), getter: () -> T) -> MutableProperty<T>
Parameters
host
The object the property is to be associated with.
key
The address of the key this value is associated with.
setter
Closure defining how the new value from a
.Next
event of thisMutableProperty
should be set on the original object.getter
Close defining how the initial value of this
MutableProperty
should be set.