ThreadsafeDict

public class ThreadsafeDict<Key, Value> where Key : Hashable
extension ThreadsafeDict: Encodable where Key: Encodable, Value: Encodable
extension ThreadsafeDict: Decodable where Key: Decodable, Value: Decodable

Threadsafe Dictionary using reader/writer pattern Codeable/Decodable if the contained types are

  • Init

    Declaration

    Swift

    public init(_ newDict: [Key : Value])

    Parameters

    newDict

    initial dictionary

  • if key/value are decodable, provide decodable initialiser

    Declaration

    Swift

    required public init(from decoder: Decoder) throws
    where Key: Decodable, Value: Decodable
  • Returns regular dict

    Declaration

    Swift

    public var unsafeContents: [Key : Value] { get }
  • Undocumented

    Declaration

    Swift

    public subscript(index: Key) -> Value? { get set }
  • Remove Value

    Declaration

    Swift

    public func removeValue(forKey key: Key)

    Parameters

    key

    key

  • Keys

    Declaration

    Swift

    public var keys: Dictionary<Key, Value>.Keys { get }

Available where Key: Encodable, Value: Encodable

  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws