How do constraint priorities work?
The gist
A priority is a UILayoutPriority from 1 to 1000. required (1000) — the constraint must hold; anything lower is optional: the engine tries to satisfy it and, if it cannot, minimizes the deviation starting from the lowest priorities. Named values: .required (1000), .defaultHigh (750), .defaultLow (250), .fittingSizeLevel (50).
Priorities exist to express preferences rather than hard rules: "width 300 if it fits, but never wider than the parent", "button on the left, but if the text doesn't fit it wraps". Without them every mismatch becomes an unsatisfiable conflict.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep