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
The mobile team at a mid-sized company is building a new iOS app to replace their aging address book integration. The app needs a contacts screen that loads a list of people (name + email) and lets support staff quickly update a contact's display name without refreshing the whole list — a common action when someone changes their name after a company merger.
The previous implementation used a table view with string-based cell identifiers and full model reloads on every update. This caused visible flicker when a name was edited and made the app feel slow. The engineering lead has asked you to rebuild the contacts screen as a ContactsViewController using a collection view, keeping the code programmatic (no storyboards or nibs).
The view controller should be self-contained and ready to drop into a UINavigationController. Hard-code an initial list of 20 contacts so the screen is fully usable without a real backend. Each contact should have a unique identifier, a full name, and an email address.
The screen must also support:
The layout does not need to be elaborate, but it should be built with extensibility in mind — the list may gain multiple sections or supplementary views in the future.
Produce a single Swift source file named ContactsViewController.swift containing the complete ContactsViewController implementation. The file should include:
Contact model type (with an id field, name, and email)ContactsViewController class with all collection view setup done programmaticallyupdateContact(_ contact: Contact) method that updates the named contact efficientlyNo external dependencies, third-party libraries, or additional files are required. The file should compile against iOS 15+ with Xcode's standard UIKit framework.