11. Xcode Shortcuts
Size to Fit Content:
Update Frames:
Control + Drag to Add Constraints
Hold shift to select multiple options
Hold option for alternates (1:1 aspect ratio and toggle
margins)
⌘=
⌥⌘=
13. Best Practices
Don’t over constrain things
Use intrinsic content size
Subviews shouldn’t add constraints on their size.
Set translatesAutoresizingMaskIntoConstraints to NO
Write less code
14. Debugging Constraints
Use the view debugger to live inspect constraints
- (NSArray<__kindof NSLayoutConstraint *>
*)constraintsAffectingLayoutForAxis:(UILayoutConstraintAxis)axis
- (BOOL)hasAmbiguousLayout
- (void)exerciseAmbiguityInLayout