Reference

open class Reference: Element

A reference from one resource to another.

  • A reference from one resource to another.

    Declaration

    Swift

    override open class var resourceType: String
  • Text alternative for the resource.

    Declaration

    Swift

    public var display: FHIRString?
  • Logical reference, when literal reference is not known.

    Declaration

    Swift

    public var identifier: Identifier?
  • Literal reference, Relative, internal or absolute URL.

    Declaration

    Swift

    public var reference: FHIRString?
  • Literal reference, Relative, internal or absolute URL.

    Declaration

    Swift

    override open func populate(from json: FHIRJSON, context instCtx: inout FHIRInstantiationContext)

    Parameters

    json

    The JSON element to use to populate the receiver

    context

    The instantiation context to use

  • Undocumented

    Declaration

    Swift

    open class Reference: Element
  • Determines if a reference has already been resolved, if it is a contained or a bundled resource which can be returned immediately.

    If this method returns nil, it’s possible that the referenced resource must be fetched from a server. Use the resolve(type:callback:) method to achive that feat. That method will initially call this method and hence may return immediately if a reference has already been resolved (or is contained/bundled).

    Declaration

    Swift

    public func resolved<T: Resource>(_ type: T.Type) -> T?

    Parameters

    type

    The resource type that should be dereferenced

    Return Value

    An instance of the desired type, nil if it cannot immediately be resolved OR if it is of a different type

  • Resolves the reference, automatically determining how to resolve it from either contained, bundled or fetching from a server.

    Checks if a reference can be resolved immediately by calling resolved(type:) first, if not proceeds to request the referenced resource from the respective location. Contained resources are always found by resolved(type:), so this method body is only executed if no contained resource with the given identifier was found.

    Declaration

    Swift

    public func resolve<T: Resource>(_ type: T.Type, callback: @escaping ((T?) -> Void))

    Parameters

    type

    The type of the resource to expect

    callback

    The callback to call upon success or failure, with the resolved resource or nil