Link

public enum Link

A representation of Linked Resources that a field may point to in your content model. This stateful type safely highlights links that have been resolved to Entries, Assets, or if they are still unresolved. If your data model conforms to ContentModellable or EntryModellable you can also use the at method to extract an instance of your linked type.

  • The Link is unresolved, and therefore contains a dictionary of metadata describing the linked resource.

    Declaration

    Swift

    case unresolved(LinkSys)
  • id

    The unique identifier of the linked asset or entry

    Declaration

    Swift

    public var id: String
  • The linked Entry, if it exists.

    Declaration

    Swift

    public var entry: Entry?
  • The linked Asset, if it exists.

    Declaration

    Swift

    public var asset: Asset?
  • Extract the concrete type conforming to ContentModellable which the specified field points to.

    Declaration

    Swift

    public static func at<ValueType: EntryModellable>(_ fieldName: String, in fields: [String: Any], linkDepth: Int) -> ValueType?

    Parameters

    fieldName

    The name of the field where there is a linked Resource.

    linkDepth

    Interally used by the SDK to prevent infinite loops when resolving links.

    Return Value

    Intance of concrete type conforming to ContentModellable that is Linked.

  • Extract the concrete type conforming to ContentModellable which the specified field points to.

    Declaration

    Swift

    public static func at(_ fieldName: String, in fields: [String: Any]) -> Asset?

    Parameters

    fieldName

    The name of the field where there is a linked Resource.

    Return Value

    The linked Asset.