NSView equivalent to UIView's systemLayoutSizeFitting

How can I calculate the optimal size of a NSView based on its current constraints and a target size?

UIView provides: func systemLayoutSizeFitting(_ targetSize: CGSize) -> CGSize func systemLayoutSizeFitting( _ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriority) -> CGSize

What would the equivalent NSView code for calculating the size?

NSView's fittingSize only provides the minimum size of the view that satisfies the constraints it holds.

Upvotes: 1

Views: 40

Answers (0)

Related Questions