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 Class | Logical Width (pt) | Common Failure Mode | Recommended Guard |
|---|---|---|---|
| Compact (iPhone SE) | 320–375 pt | Horizontal button stacks clip trailing titles | Switch UIStackView.axis when width < 360 pt |
| Standard (iPhone 15/16) | 390–393 pt | Fixed-height cells clip 2-line localized text | Use UITableView.automaticDimension |
| Large / Pro Max | 428–430 pt | Unreadable 80+ character prose lines | Pin content to readableContentGuide |
| iPad Split View (1/3) | 320 pt | Assumes .regular horizontal size class | Observe 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