CPCViewMeasuring

public protocol CPCViewMeasuring

A view type that is capable of calculating fitting size for instances statically.

  • A type containing information required for view size calculations.

    Declaration

    Swift

    associatedtype LayoutAttributes : CPCViewLayoutAttributes
  • Asks the view type to calculate and return the size for its instance that best fits the specified size.

    Declaration

    Swift

    static func sizeThatFits(_ size: CGSize, with attributes: LayoutAttributes) -> CGSize

    Parameters

    size

    The size for which the view type should calculate its best-fitting size.

    attributes

    Additional attributes to be taken into consideration by view type when calculating best-fitting size.

    Return Value

    A new size that is adequate for given input parameters.

  • widthThatFits(height:with:) Default implementation

    Asks the view type to calculate and return width for its instance given a specific height constraint.

    Note

    Default implementation calls sizeThatFits (_:with:) with infinite width.

    Default Implementation

    Declaration

    Swift

    static func widthThatFits(height: CGFloat, with attributes: LayoutAttributes) -> CGFloat

    Parameters

    height

    The height for which the view type should calculate its best-fitting width.

    attributes

    Additional attributes to be taken into consideration by view type when calculating best-fitting width.

    Return Value

    A new width that is adequate for given input parameters.

  • heightThatFits(width:with:) Default implementation

    Asks the view type to calculate and return height for its instance given a specific width constraint.

    Note

    Default implementation calls sizeThatFits (_:with:) with infinite height.

    Default Implementation

    Declaration

    Swift

    static func heightThatFits(width: CGFloat, with attributes: LayoutAttributes) -> CGFloat

    Parameters

    width

    The width for which the view type should calculate its best-fitting height.

    attributes

    Additional attributes to be taken into consideration by view type when calculating best-fitting height.

    Return Value

    A new height that is adequate for given input parameters.

  • Current layout attributes associated with this view instance.

    Declaration

    Swift

    var layoutAttributes: LayoutAttributes? { get }
  • sizeThatFits(_:attributes:) Default implementation

    Asks the view to calculate and return the size that best fits the specified size.

    Note

    Default implementation calls type method with same name.

    Default Implementation

    Declaration

    Swift

    func sizeThatFits(_ size: CGSize, attributes: LayoutAttributes) -> CGSize

    Parameters

    size

    The size for which the view should calculate its best-fitting size.

    attributes

    Additional attributes to be taken into consideration when calculating best-fitting size.

    Return Value

    A new size that is adequate for given input parameters.