IdentifiableResource

public protocol IdentifiableResource: Resource

Defines a resource which is identifiable. That is, it has an id property and instances can be retrieved from the remote API by ID. This also implies that the resource is listable. So it includes the requirement for the parse(collection:) function.

Note: Do not use this protocol directly. You should instead conform your resources to RootResource or ChildResource

  • id

    A getter for a resource’s identifier.

    Declaration

    Swift

    var id: ID
  • ID

    The type used to identify a resource e.g. a UUID or String

    Declaration

    Swift

    associatedtype ID
  • The expected return type when parsing a collection of resources. This is explict rather than defaulting to [Self] so that custom wrapper types can be specified if required.

    Declaration

    Swift

    associatedtype Collection
  • A static function required for parsing a collection of resources. The Data is the result from a call to the network.

    Declaration

    Swift

    static func parse(collection data: Data) throws -> Collection