SharedContext

public final class SharedContext : @unchecked Sendable

A class that manages a shared context using a dictionary.

  • Initializes the SharedContext with an empty dictionary or a pre-existing one.

    Declaration

    Swift

    public init(_ map: [String : Any] = [:])

    Parameters

    map

    A dictionary to initialize the context with. Defaults to an empty dictionary.

  • Sets a value for the given key in the shared context.

    Declaration

    Swift

    public func set(key: String, value: Any)

    Parameters

    key

    The key for which to set the value.

    value

    The value to set for the given key.

  • Retrieves the value for the given key from the shared context.

    Declaration

    Swift

    public func get(key: String) -> Any?

    Parameters

    key

    The key for which to get the value.

    Return Value

    The value associated with the key, or nil if the key does not exist.

  • Removes the value for the given key from the shared context.

    Declaration

    Swift

    public func removeValue(forKey key: String) -> Any?

    Parameters

    key

    The key for which to remove the value.

    Return Value

    The removed value, or nil if the key does not exist.

  • A Boolean value indicating whether the shared context is empty.

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • A namespace for key names to be added in an extension.

    Declaration

    Swift

    public enum Keys