OutputSizeHelper

public enum OutputSizeHelper

Provides helper functions to determine output sizes given input sizes and other constraints (aspect ratio, orientation, etc.)

  • Returns the size normalized to a new aspect ratio and orientation. For example, given an input size of 1080x1920 and aspect ratio of 0.462 and portrait orientation, this will return a new size of 887x1920.

    Declaration

    Swift

    public static func normalizedSize(
        for size: CGSize, aspectRatio: CGFloat, orientation: AVCaptureVideoOrientation = .portrait
    ) -> CGSize

    Parameters

    size

    The original input size to normalize.

    aspectRatio

    The aspect ratio to normalize the output size to.

    orientation

    The orientation of the input size (defaults to portrait).

    Return Value

    The new size normalized to the aspect ratio.