Layout Priorities

Layout priority used to indicate the relative importance of constraints, allowing Auto Layout to make appropriate tradeoffs when satisfying the constraints of the system as a whole.

Symbols

Constants

let NSLayoutPriorityRequired: NSLayoutPriority

A required constraint. Do not specify a layout constraint that exceeds this number.

let NSLayoutPriorityDefaultHigh: NSLayoutPriority

Priority level with which a button resists compressing its content. Note that the level is higher than NSLayoutPriorityWindowSizeStayPut. This means dragging to resize a window will not make buttons clip, rather the window frame is constrained.

let NSLayoutPriorityDragThatCanResizeWindow: NSLayoutPriority

Appropriate priority level for a drag that may end up resizing the window. This drag does not need to explicitly resize the window. The user might be dragging around window contents, and it might be desirable for the window get bigger to accommodate those contents.

let NSLayoutPriorityWindowSizeStayPut: NSLayoutPriority

Priority level for the window’s current size. It's generally not appropriate to make a constraint at exactly this priority. You want to be higher or lower. Constraints with higher priorities can adjust the window’s size. Constraints with lower priorities must be fulfilled using the current window size.

let NSLayoutPriorityDragThatCannotResizeWindow: NSLayoutPriority

Priority level at which a split view divider, say, is dragged. It won't resize the window.

let NSLayoutPriorityDefaultLow: NSLayoutPriority

Priority level at which a button hugs its contents horizontally.

let NSLayoutPriorityFittingSizeCompression: NSLayoutPriority

When you send a fittingSize message to a view, the smallest size that is large enough for the view's contents is computed. This is the priority level with which the view wants to be as small as possible in that computation. It's quite low. It is generally not appropriate to make a constraint at exactly this priority. You want to be higher or lower.