AssetProtocol

public protocol AssetProtocol : FlatResource

A simple protocol to bridge Contentful.Asset and other formats for storing asset information.

  • String representation for the URL of the media file associated with this asset.

    Declaration

    Swift

    var urlString: String? { get }
  • url(with:) Extension method

    The URL for the underlying media file with additional options for server side manipulations such as format changes, resizing, cropping, and focusing on different areas including on faces, among others.

    Throws

    Will throw SDKError if the SDK is unable to generate a valid URL with the desired ImageOptions.

    Declaration

    Swift

    func url(with imageOptions: [ImageOption] = []) throws -> URL

    Parameters

    imageOptions

    An array of ImageOption that will be used for server side manipulations.

    Return Value

    The URL for the image with the image manipulations, represented in the imageOptions parameter, applied.