/
Launch Apollo Studio


CLASS

Atomic

public class Atomic<T>

Wrapper for a value protected by an NSLock

Properties

value

public var value: T

The current value.

Methods

init(_:)

public init(_ value: T)

Designated initializer

  • Parameter value: The value to begin with.

Parameters

NameDescription
valueThe value to begin with.

mutate(block:)

public func mutate(block: (inout T) -> Void)

Mutates the underlying value within a lock. Mostly useful for mutating the contents of Atomic wrappers around collections.

  • Parameter block: The block to execute to mutate the value.

Parameters

NameDescription
blockThe block to execute to mutate the value.
Edit on GitHub