DispatchedMutableDictionary

@objc public class DispatchedMutableDictionary: NSObject, DispatchedValueWrapper

Thread-safe value wrapper for NSMutableDictionary, using dispatch queues to achieve synchronization. This class is KVO-compliant. You may observe its value property to be notified of changes. This is applicable to Cocoa bindings.

Seealso

DispatchedValueWrapper
  • The wrapped value type, NSMutableDictionary.

    Declaration

    Swift

    public typealias ValueType = NSMutableDictionary?
  • Initializes a dispatched value object.
    This initializer will use the main queue for synchronization.

    Declaration

    Swift

    public required convenience init( value: ValueType )
  • Initializes a dispatched value object.

    Declaration

    Swift

    public required init( value: ValueType = nil, queue: DispatchQueue = DispatchQueue.main )
  • The wrapped NSMutableDictionary value.
    This property is KVO-compliant.

    Declaration

    Swift

    @objc public dynamic var value: ValueType
  • Atomically gets the wrapped NSMutableDictionary value.
    The getter will be executed on the queue specified in the initialzer.

    Declaration

    Swift

    public func get() -> ValueType

    Return Value

    The actual NSMutableDictionary value.

  • Atomically sets the wrapped NSMutableDictionary value.
    The setter will be executed on the queue specified in the initialzer.

    -parameter value: The NSMutableDictionary value to set.

    Declaration

    Swift

    public func set( _ value: ValueType )
  • Atomically executes a closure on the wrapped NSMutableDictionary value.
    The closure will be passed the actual value of the wrapped NSMutableDictionary value, and is guaranteed to be executed atomically, on the queue specified in the initialzer.

    -parameter closure: The close to execute.

    Declaration

    Swift

    public func execute( closure: ( ValueType ) -> Swift.Void )
  • Atomically executes a closure on the wrapped NSMutableDictionary value, returning some value. The closure will be passed the actual value of the wrapped NSMutableDictionary value, and is guaranteed to be executed atomically, on the queue specified in the initialzer.

    -parameter closure: The close to execute, returning some value.

    Declaration

    Swift

    public func execute< R >( closure: ( ValueType ) -> R ) -> R