Builder

class Builder

A builder used to apply settings and filters.

  • Meta provides data regarding the image processing operations that would be performed. When meta is used, the resulting URL will return a JSON string, not an image.

    Declaration

    Swift

    public func meta(_ enabled: Bool = true) -> Self

    Parameters

    enabled

    Whether meta is enabled or not. Defaults to false if method is not called

    Return Value

    The builder

  • Trim will select the appropriate corner to trim.

    Declaration

    Swift

    public func trim(_ corner: TrimCorner = .topLeft) -> Self

    Parameters

    corner

    The corner used while trimming. Defaults to top-left

    Return Value

    The builder

  • Crop will define which area of the image should be cropped before resizing and filtering.

    Declaration

    Swift

    public func crop(leftTop: (x: Int, y: Int), rightBottom: (x: Int, y: Int)) -> Self

    Parameters

    leftTop

    The left-top (x,y) coordinate

    rightBottom

    The right-bottom (x,y) coordinate

    Return Value

    The builder

  • Fit in specifies that the image should not be auto-cropped, but auto-resized.

    Declaration

    Swift

    public func fitIn(_ enabled: Bool = true) -> Self

    Parameters

    enabled

    Whether fit-in is enabled or not. Defaults to false if method is not called

    Return Value

    The builder

  • Resize will define the dimensions of the image.

    Declaration

    Swift

    public func resize(width: CGFloat, height: CGFloat) -> Self

    Parameters

    width

    The width of the image

    height

    The height of the image

    Return Value

    The builder

  • Resize will define the dimensions of the image.

    Declaration

    Swift

    public func resize(size: CGSize) -> Self

    Parameters

    size

    The size of the image

    Return Value

    The builder

  • Horizontal and vertical align If the image is cropped to a different ratio and its margins needs trimming, horizontal and vertical align will specify which directions the cropping box will snap to.

    Declaration

    Swift

    public func align(horizontal: HorizontalAlign, vertical: VerticalAlign) -> Self

    Parameters

    horizontal

    Which horizontal portion should be kept

    vertical

    Which vertical portion should be kept

    Return Value

    The builder

  • Horizontal align If the image is cropped to a different ratio and its sides needs trimming, horizontal align will specify which direction the cropping box will snap to.

    Declaration

    Swift

    public func align(horizontal: HorizontalAlign) -> Self

    Parameters

    horizontal

    Which horizontal portion should be kept

    Return Value

    The builder

  • Vertical align If the image is cropped to a different ratio and its margins needs trimming, vertical align will specify which direction the cropping box will snap to.

    Declaration

    Swift

    public func align(vertical: VerticalAlign) -> Self

    Parameters

    vertical

    Which vertical portion should be kept

    Return Value

    The builder

  • Smart detectors Enables the use of detectors. Detectors need to be enabled on the server as well.

    Declaration

    Swift

    public func useSmartDetectors(_ enabled: Bool = true) -> Self

    Parameters

    enabled

    Whether smart detectors are enabled or not. Defaults to false if method is not called

    Return Value

    The builder

  • Filter adds a filter to the list of processing filters.

    Declaration

    Swift

    public func filter(_ filter: Filter) -> Self

    Parameters

    filter

    A filter to be processed

    Return Value

    The builder

  • Generates the final URL String.

    Declaration

    Swift

    public func toString() -> String

    Return Value

    The URL String to the processed image (or meta JSON)

  • Generates the final URL.

    Declaration

    Swift

    public func toURL() -> URL

    Return Value

    The URL to the processed image (or meta JSON)