uikit
Skill15 starsChanged 43 days agoMITView on GitHub
Expert UIKit assistance covering UIViewController lifecycles, Auto Layout programmatically, UITableView/UICollectionView architectures, delegates, and view hierarchies. Use when maintaining production iOS applications, writing custom UIKit components, or bridging UIKit with SwiftUI.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- sreejithraman/SreeStacktheir own version, first seen Oct 27, 2026
- caglarbaranbora/Apple-Agent-Kittheir own version, first seen Oct 13, 2026
- mimukit/skillstheir own version, first seen Jul 13, 2026
- Prisma-Labs-Dev/apple-skillstheir own version, first seen Apr 14, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- Prisma-Labs-Dev/apple-skills★ 336same name
- mimukit/skills★ 2same name
- caglarbaranbora/Apple-Agent-Kit★ 1same name
- sreejithraman/SreeStack★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 156
Use translatesAutoresizingMaskIntoConstraints = false: Always disable autotranslation on programmatically created views before activating …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
UIKit
UIKit is the traditional, imperative framework for building iOS user interfaces. While SwiftUI is the future, UIKit remains essential for maintaining existing apps and unrestricted access to the OS.
When to Use
- Production iOS Codebase Maintenance: Maintaining and extending established enterprise iOS applications built on UIKit.
- Fine-Grained Touch & Gesture Control: Implementing bespoke drag-and-drop, gesture recognizers, and custom touch tracking.
- Complex UICollectionView Layouts: Building high-performance custom layouts with
UICollectionViewCompositionalLayoutand Diffable Data Sources. - SwiftUI Interoperability: Hosting complex UIKit view controllers inside SwiftUI via
UIViewControllerRepresentable.
Quick Start
// Programmatic UIKit (No Storyboards) in SceneDelegate
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
window?.rootViewController = UINavigationController(rootViewController: HomeViewController())
window?.makeKeyAndVisible()
}
class HomeViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
title = "UIKit Home"
let button = UIButton(type: .system)
button.setTitle("Tap Me", for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
NSLayoutConstraint.activate([
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
}Core Concepts
UICollectionView Diffable Data Sources & Compositional Layout
Eliminates index-path calculation bugs by managing list state through unique hashable identifiers and snapshots:
final class FeedViewController: UIViewController {
enum Section { case main }
struct Post: Hashable { let id: UUID; let title: String }
private var collectionView: UICollectionView!
private var dataSource: UICollectionViewDiffableDataSource<Section, Post>!
override func viewDidLoad() {
super.viewDidLoad()
configureLayout()
configureDataSource()
}
private func configureLayout() {
var config = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: UICollectionViewCompositionalLayout.list(using: config))
view.addSubview(collectionView)
}
private func configureDataSource() {
let registration = UICollectionView.CellRegistration<UICollectionViewListCell, Post> { cell, _, item in
var content = cell.defaultContentConfiguration()
content.text = item.title
cell.contentConfiguration = content
}
dataSource = UICollectionViewDiffableDataSource<Section, Post>(collectionView: collectionView) { cv, ip, item in
cv.dequeueConfiguredReusableCell(using: registration, for: ip, item: item)
}
}
}UIViewController Lifecycle Flow
Strictly isolates setup, layout, and appearance phases to ensure optimal memory and rendering performance:
class OrderDetailViewController: UIViewController {
override func loadView() {
// Instantiate and assign custom root view (bypassing storyboard)
self.view = OrderDetailRootView()
}
override func viewDidLoad() {
super.viewDidLoad()
// One-time data binding, notification registration
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Refresh lightweight view state
}
}Programmatic Layout Anchor Constraints
Constructs responsive layouts programmatically without external dependencies:
NSLayoutConstraint.activate([
headerView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
headerView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16),
headerView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16),
headerView.heightAnchor.constraint(equalToConstant: 64)
])Common Patterns
Programmatic Auto Layout with NSLayoutConstraint
Problem: Storyboard merge conflicts and fragile constraint debugging in team repositories.
Solution: Construct view hierarchies and constraints purely in Swift.
final class ProfileViewController: UIViewController {
private let titleLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.font = .systemFont(ofSize: 20, weight: .bold)
return label
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
view.addSubview(titleLabel)
NSLayoutConstraint.activate([
titleLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
titleLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
}Best Practices
Do:
- Adopt Diffable Data Sources: Replace error-prone
reloadData()andperformBatchUpdates()with atomicNSDiffableDataSourceSnapshot. - Use
translatesAutoresizingMaskIntoConstraints = false: Always disable autotranslation on programmatically created views before activating constraints. - Bridge with SwiftUI: Wrap new feature views in
UIHostingControllerrather than rebuilding everything in UIKit. - Audit Retain Cycles in Closures: Capture
[weak self]in completion handlers and event closures to prevent ViewController leaks.
Don't:
- Trigger expensive layout inside
draw(_:): Keep custom core graphics rendering strictly inside draw methods; avoid layout passes. - Hardcode frame coordinates: Avoid explicit
CGRect(x: ..., y: ...)math; use Auto Layout or safe area layout guides. - Block the main thread: Perform data decoding and persistence asynchronously and update UIKit views on
MainActor.
Troubleshooting
| Error | Cause | Solution |
Unsatisfiable Constraints | Conflicting Auto Layout rules. | Check console log for breaking constraint IDs; simplify rules. |
TableView Updates Crash | Inconsistent data vs rows. | Use Diffable Data Source or ensure data model updates before insertRows. |
Retain Cycle | Strong reference loop. | Use Memory Graph Debugger; verify [weak self]. |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

