
Auto Layout is core to building adaptive iOS interfaces in Evernote, where the same screen must work across iPhone sizes, iPad, rotation, Dynamic Type, and split view.
Explain how you would implement Auto Layout in an iOS app, using a concrete example such as an Evernote note editor header or note list cell.
Address these points:
The interviewer expects a practical engineering explanation rather than UIKit trivia. Focus on how the constraint system works, how you would structure a maintainable layout in code, and how you would debug common issues in a production Evernote iOS screen.
Auto Layout represents relationships between view anchors such as top, leading, width, and height. A valid layout is produced when the system has enough non-conflicting constraints to determine each view’s frame.
titleLabel.topAnchor.constraint(equalTo: container.topAnchor, constant: 12)
Some views, such as labels, buttons, and images, provide a natural size based on their content. Auto Layout uses that size unless constraints or priorities require the view to stretch or shrink.
titleLabel.setContentCompressionResistancePriority(.required, for: .vertical)
Content hugging controls how strongly a view resists growing larger than its intrinsic size, while compression resistance controls how strongly it resists shrinking smaller. These priorities are essential when multiple views compete for limited space.
tagLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
Not every constraint must be required. Lower-priority constraints let the system choose the best compromise when the layout cannot satisfy every preference, which is common in localized text and Dynamic Type scenarios.
subtitleLabel.bottomAnchor.constraint(lessThanOrEqualTo: container.bottomAnchor, constant: -12).priority = .defaultHigh
Safe areas keep content clear of notches, home indicators, and system bars. When layouts break, Xcode logs, the view debugger, and methods like hasAmbiguousLayout help identify missing or conflicting constraints.
editorView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor)