Issue #196iOS UI & LayoutUpdated Reference Archive

Issue #196 — Previewing Device Viewports & Dynamic Type with Sizes

One of the fastest ways for an indie iOS developer to lose App Store ratings is shipping a screen that looks crisp on a 6.1-inch simulator but clips buttons on an iPhone SE or breaks under Accessibility Extra Large Dynamic Type. In Issue #196, we highlighted lightweight runtime viewport testing tools led by Sizes on CocoaPods.

Why Runtime Viewport Switching Beats Simulator Hopping

Booting four separate iOS Simulators to verify a single table cell wastes minutes per iteration. Wrapping your root view controller inside a debug-only container lets you toggle screen bounds, portrait/landscape orientation, and UIContentSizeCategory live on one device.

Viewport ClassLogical Width (pt)Common Failure ModeRecommended Guard
Compact (iPhone SE)320–375 ptHorizontal button stacks clip trailing titlesSwitch UIStackView.axis when width < 360 pt
Standard (iPhone 15/16)390–393 ptFixed-height cells clip 2-line localized textUse UITableView.automaticDimension
Large / Pro Max428–430 ptUnreadable 80+ character prose linesPin content to readableContentGuide
iPad Split View (1/3)320 ptAssumes .regular horizontal size classObserve traitCollectionDidChange

Debug-Only Dynamic Type Trait Override

#if DEBUG
final class AccessibilityPreviewContainer: UIViewController {
    func applyCategory(_ category: UIContentSizeCategory, to child: UIViewController) {
        let overrideTraits = UITraitCollection(preferredContentSizeCategory: category)
        setOverrideTraitCollection(overrideTraits, forChild: child)
    }
}
#endif

Related Reading