Review Swift and UIKit code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems — do not nitpick or invent issues.
Review process:
- Check for deprecated API using
references/api.md.
- Check that views, subclassing, and composition patterns follow best practices using
references/views.md.
- Validate Auto Layout usage and constraint patterns using
references/layout.md.
- Ensure view controller lifecycle and architecture are correct using
references/controllers.md.
- Ensure navigation patterns are modern and maintainable using
references/navigation.md.
- Validate UITableView and UICollectionView usage using
references/tableview-collectionview.md.
- Ensure the code uses designs that are accessible and compliant with Apple's Human Interface Guidelines using
references/design.md.
- Validate accessibility compliance including Dynamic Type, VoiceOver, and traits using
references/accessibility.md.
- Ensure the code runs efficiently using
references/performance.md.
- Check concurrency and thread safety using
references/concurrency.md.
- Quick validation of Swift code using
references/swift.md.
- Final code hygiene check using
references/hygiene.md.
If doing a partial review, load only the relevant reference files.
Core Instructions
- iOS 26 exists and is the latest iOS version. Target iOS 17 or later as the minimum deployment target for new code, unless the project specifies otherwise.
- Target Swift 6.2 or later, using modern Swift concurrency.
- Respect the project's deployment target. Before suggesting a modern API, check its availability. If the project targets an older iOS version, recommend the best available alternative and wrap newer APIs in
if #available checks. Reference files mark key APIs with their iOS version (e.g., "iOS 15+"). Do not suggest APIs unavailable at the project's minimum target without providing a fallback.
- As a UIKit developer, the user expects UIKit patterns. Do not suggest SwiftUI replacements unless explicitly requested.
- Do not introduce third-party frameworks without asking first.
- Break different types up into different Swift files rather than placing multiple classes, structs, or enums into a single file.
- Use a consistent project structure, with folder layout determined by app features.
- Prefer programmatic UI with Auto Layout anchors over Storyboards and XIBs for new code, unless the project already uses Interface Builder extensively.
Output Format
Organize findings by file. For each issue:
- State the file and relevant line(s).
- Name the rule being violated (e.g., "Use
UIAlertController instead of UIAlertView").
- Show a brief before/after code fix.
Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.
Example output:
ProfileViewController.swift
Line 8: Use UIAlertController instead of deprecated UIAlertView.
// Before
let alert = UIAlertView(title: "Error", message: msg, delegate: self, cancelButtonTitle: "OK")
alert.show()
// After
let alert = UIAlertController(title: "Error", message: msg, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default))
present(alert, animated: true)
Line 24: Batch constraint activation with NSLayoutConstraint.activate.
// Before
label.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
label.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
// After
NSLayoutConstraint.activate([
label.topAnchor.constraint(equalTo: view.topAnchor),
label.leadingAnchor.constraint(equalTo: view.leadingAnchor)
])
Line 42: Set translatesAutoresizingMaskIntoConstraints = false before adding constraints.
// Before
view.addSubview(label)
label.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
// After
label.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(label)
NSLayoutConstraint.activate([
label.topAnchor.constraint(equalTo: view.topAnchor)
])
Summary
- Deprecated API (high):
UIAlertView on line 8 must be replaced with UIAlertController.
- Layout (medium): Individual constraint activation on line 24 should use
NSLayoutConstraint.activate.
- Layout (medium): Missing
translatesAutoresizingMaskIntoConstraints on line 42 causes constraint conflicts.
End of example.
References
references/api.md — deprecated UIKit APIs and their modern replacements.
references/views.md — UIView lifecycle, composition, subclassing, and custom drawing.
references/layout.md — Auto Layout, layout anchors, UIStackView, intrinsic content size, Safe Area.
references/controllers.md — UIViewController lifecycle, container controllers, avoiding Massive View Controller.
references/navigation.md — navigation controllers, tab bars, coordinator pattern, modal presentation.
references/tableview-collectionview.md — diffable data sources, compositional layout, cell configuration, prefetching.
references/design.md — Human Interface Guidelines, UIAppearance, trait collections, Dark Mode, adaptive layouts.
references/accessibility.md — VoiceOver, Dynamic Type, accessibility traits, labels, and hints.
references/performance.md — off-screen rendering, layer optimization, image caching, main thread performance.
references/concurrency.md — main thread safety, async/await, DispatchQueue migration, background tasks.
references/swift.md — modern Swift code, Swift concurrency, Objective-C interop.
references/hygiene.md — memory management, retain cycles, KVO/notification cleanup, deinit patterns.
1---
2name: uikit-max
3description: >-
4 Comprehensively reviews UIKit code for best practices on modern APIs,
5 architecture, and performance. Use when reading, writing, or reviewing
6 UIKit-based iOS projects, including UIViewController, UITableView,
7 UICollectionView, Auto Layout, or programmatic UI code. Also use when
8 migrating legacy UIKit patterns to modern equivalents. Do not use for
9 SwiftUI-only projects or Combine-only logic with no UIKit dependency.
10license: MIT
11metadata:
12 source: https://skillmd.com/skills/tornikegomareli/uikit-max
13 author: tgomareli
14 version: "1.0"
15---
16
17Review Swift and UIKit code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems — do not nitpick or invent issues.
18
19Review process:
20
211. Check for deprecated API using `references/api.md`.
221. Check that views, subclassing, and composition patterns follow best practices using `references/views.md`.
231. Validate Auto Layout usage and constraint patterns using `references/layout.md`.
241. Ensure view controller lifecycle and architecture are correct using `references/controllers.md`.
251. Ensure navigation patterns are modern and maintainable using `references/navigation.md`.
261. Validate UITableView and UICollectionView usage using `references/tableview-collectionview.md`.
271. Ensure the code uses designs that are accessible and compliant with Apple's Human Interface Guidelines using `references/design.md`.
281. Validate accessibility compliance including Dynamic Type, VoiceOver, and traits using `references/accessibility.md`.
291. Ensure the code runs efficiently using `references/performance.md`.
301. Check concurrency and thread safety using `references/concurrency.md`.
311. Quick validation of Swift code using `references/swift.md`.
321. Final code hygiene check using `references/hygiene.md`.
33
34If doing a partial review, load only the relevant reference files.
35
36
37## Core Instructions
38
39- iOS 26 exists and is the latest iOS version. Target iOS 17 or later as the minimum deployment target for new code, unless the project specifies otherwise.
40- Target Swift 6.2 or later, using modern Swift concurrency.
41- **Respect the project's deployment target.** Before suggesting a modern API, check its availability. If the project targets an older iOS version, recommend the best available alternative and wrap newer APIs in `if #available` checks. Reference files mark key APIs with their iOS version (e.g., "iOS 15+"). Do not suggest APIs unavailable at the project's minimum target without providing a fallback.
42- As a UIKit developer, the user expects UIKit patterns. Do not suggest SwiftUI replacements unless explicitly requested.
43- Do not introduce third-party frameworks without asking first.
44- Break different types up into different Swift files rather than placing multiple classes, structs, or enums into a single file.
45- Use a consistent project structure, with folder layout determined by app features.
46- Prefer programmatic UI with Auto Layout anchors over Storyboards and XIBs for new code, unless the project already uses Interface Builder extensively.
47
48
49## Output Format
50
51Organize findings by file. For each issue:
52
531. State the file and relevant line(s).
542. Name the rule being violated (e.g., "Use `UIAlertController` instead of `UIAlertView`").
553. Show a brief before/after code fix.
56
57Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.
58
59Example output:
60
61### ProfileViewController.swift
62
63**Line 8: Use `UIAlertController` instead of deprecated `UIAlertView`.**
64
65```swift
66// Before
67let alert = UIAlertView(title: "Error", message: msg, delegate: self, cancelButtonTitle: "OK")
68alert.show()
69
70// After
71let alert = UIAlertController(title: "Error", message: msg, preferredStyle: .alert)
72alert.addAction(UIAlertAction(title: "OK", style: .default))
73present(alert, animated: true)
74```
75
76**Line 24: Batch constraint activation with `NSLayoutConstraint.activate`.**
77
78```swift
79// Before
80label.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
81label.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
82
83// After
84NSLayoutConstraint.activate([
85 label.topAnchor.constraint(equalTo: view.topAnchor),
86 label.leadingAnchor.constraint(equalTo: view.leadingAnchor)
87])
88```
89
90**Line 42: Set `translatesAutoresizingMaskIntoConstraints = false` before adding constraints.**
91
92```swift
93// Before
94view.addSubview(label)
95label.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
96
97// After
98label.translatesAutoresizingMaskIntoConstraints = false
99view.addSubview(label)
100NSLayoutConstraint.activate([
101 label.topAnchor.constraint(equalTo: view.topAnchor)
102])
103```
104
105### Summary
106
1071. **Deprecated API (high):** `UIAlertView` on line 8 must be replaced with `UIAlertController`.
1082. **Layout (medium):** Individual constraint activation on line 24 should use `NSLayoutConstraint.activate`.
1093. **Layout (medium):** Missing `translatesAutoresizingMaskIntoConstraints` on line 42 causes constraint conflicts.
110
111End of example.
112
113
114## References
115
116- `references/api.md` — deprecated UIKit APIs and their modern replacements.
117- `references/views.md` — UIView lifecycle, composition, subclassing, and custom drawing.
118- `references/layout.md` — Auto Layout, layout anchors, UIStackView, intrinsic content size, Safe Area.
119- `references/controllers.md` — UIViewController lifecycle, container controllers, avoiding Massive View Controller.
120- `references/navigation.md` — navigation controllers, tab bars, coordinator pattern, modal presentation.
121- `references/tableview-collectionview.md` — diffable data sources, compositional layout, cell configuration, prefetching.
122- `references/design.md` — Human Interface Guidelines, UIAppearance, trait collections, Dark Mode, adaptive layouts.
123- `references/accessibility.md` — VoiceOver, Dynamic Type, accessibility traits, labels, and hints.
124- `references/performance.md` — off-screen rendering, layer optimization, image caching, main thread performance.
125- `references/concurrency.md` — main thread safety, async/await, DispatchQueue migration, background tasks.
126- `references/swift.md` — modern Swift code, Swift concurrency, Objective-C interop.
127- `references/hygiene.md` — memory management, retain cycles, KVO/notification cleanup, deinit patterns.