RSDResourceTransformer

public protocol RSDResourceTransformer : RSDDecodableBundleInfo

RSDResourceTransformer is a protocol for getting either embedded resources or online resources.

Seealso

RSDStepResourceTransformer and RSDTaskResourceTransformer
  • Either a fully qualified URL string or else a relative reference to either an embedded resource or a relative URL defined globally by overriding the RSDResourceConfig class methods.

    Declaration

    Swift

    var resourceName: String { get }
  • The classType for converting the resource to an object.

    Declaration

    Swift

    var classType: String? { get }
  • estimatedFetchTime Extension method

    The estimated time required to fetch the resource.

    Declaration

    Swift

    public var estimatedFetchTime: TimeInterval { get }
  • isOnlineResourceURL() Extension method

    Whether or not the resource is an online URL or from an embedded resource bundle.

    Declaration

    Swift

    public func isOnlineResourceURL() -> Bool

    Return Value

    true if the resource is an online URL or false if it is an embedded resource.

  • fullURL() Extension method

    Get the full URL for a given resource no matter if it is a local or online resource.

    Throws

    RSDResourceTransformerError if the file cannot be found, or RSDValidationError if the online resource is not valid.

    Declaration

    Swift

    public func fullURL() throws -> URL

    Return Value

    The URL for this resource.

  • resourceURL(ofType:bundle:) Extension method

    Get the URL for a given resource. This can return either a URL to an online resource or a URL for an embedded resource.

    Throws

    RSDResourceTransformerError if the file cannot be found.

    Declaration

    Swift

    public func resourceURL(ofType defaultExtension: String? = nil, bundle: Bundle? = nil) throws -> (url: URL, resourceType: RSDResourceType)

    Parameters

    defaultExtension

    The default extension for the URL. If nil then the resourceName will be inspected for a file extension. If that is nil then json will be assumed.

    bundle

    The bundle to use for fetching the resource. If nil then the RSDResourceConfig will be used.

    Return Value

    • url: The returned URL for this resource.
    • resourceType: The resource type.

  • resourceData(ofType:bundle:) Extension method

    Get the Data for a given resource. This is used to get data from an embedded resource.

    Throws

    RSDResourceTransformerError if the file cannot be found.

    Declaration

    Swift

    public func resourceData(ofType defaultExtension: String? = nil, bundle: Bundle? = nil) throws -> (data: Data, resourceType: RSDResourceType)

    Parameters

    defaultExtension

    The default extension for the URL. If nil then the resourceName will be inspected for a file extension. If that is nil then json will be assumed.

    bundle

    The bundle to use for fetching the resource. If nil then the RSDResourceConfig will be used.

    Return Value

    • data: The returned Data for this resource.
    • resourceType: The resource type.