Identified

@dynamicMemberLookup
public struct Identified<ID, Value> : Identifiable where ID : Hashable
extension Identified: Decodable where ID: Decodable, Value: Decodable
extension Identified: Encodable where ID: Encodable, Value: Encodable
extension Identified: Equatable where Value: Equatable
extension Identified: Hashable where Value: Hashable

A wrapper around a value and a hashable identifier that conforms to identifiable.

  • id

    Declaration

    Swift

    public let id: ID
  • Undocumented

    Declaration

    Swift

    public var value: Value
  • Initializes an identified value from a given value and a hashable identifier.

    Declaration

    Swift

    public init(_ value: Value, id: ID)

    Parameters

    value

    A value.

    id

    A hashable identifier.

  • Initializes an identified value from a given value and a function that can return a hashable identifier from the value.

    Identified(uuid, id: \.self)
    

    Declaration

    Swift

    public init(_ value: Value, id: (Value) -> ID)

    Parameters

    value

    A value.

    id

    A hashable identifier.

  • Initializes an identified value from a given value and a function that can return a hashable identifier from the value.

    Identified(uuid, id: \.self)
    

    Declaration

    Swift

    public init(_ value: Value, id: KeyPath<Value, ID>)

    Parameters

    value

    A value.

    id

    A key path from the value to a hashable identifier.

  • Undocumented

    Declaration

    Swift

    public subscript<LocalValue>(
      dynamicMember keyPath: WritableKeyPath<Value, LocalValue>
    ) -> LocalValue