Write, review, or improve UIKit code following best practices for view controller lifecycle, Auto Layout, collection views, navigation, animation, memory management, and modern iOS 18–26 APIs. Use when building new UIKit features, refactoring existing views or view controllers, reviewing code quality, adopting modern UIKit patterns (diffable data sources, compositional layout, cell configuration), or bridging UIKit with SwiftUI. Does not cover SwiftUI-only code.
96
100%
Does it follow best practices?
Impact
96%
1.23xAverage score across 9 eval scenarios
Passed
No known issues
Your team is building the main dashboard screen for an iOS analytics app. The dashboard needs to show two panels side by side: a statistics summary on the left and a visualization on the right. Both panels are full view controllers managed by a central DashboardViewController. The design team has confirmed that the right panel must be swappable at runtime — users can switch between a chart view and a map view depending on which data dimension they select.
Everything must be built programmatically using UIKit, without storyboards or XIBs. The app targets iOS 15+. The dashboard will be used as the root content of a UINavigationController, so the view hierarchy must be robust and memory-safe.
Write a single Swift file named DashboardViewController.swift that contains:
DashboardViewController — the container, with:
StatsViewController embedded on the left half of the viewChartViewController embedded on the right half of the view, initiallyreplaceRightPanel(with:) that removes the current right panel and installs a new child view controller in its placeStatsViewController, ChartViewController, and any additional child VC class you use in your demo of replaceRightPanel(with:)The file should be complete and syntactically valid Swift. Include a brief comment at the top with your name and the date.