Use this skill when the task is primarily about UIKit view controllers, Auto Layout, view lifecycle, collection and table views, navigation controllers, or UIKit interoperability.
Use this skill for tasks centered on UIKit lifecycle, layout, and imperative UI behavior.
viewDidLoad, viewWillAppear, viewDidAppear, and deinit expectationsUIHostingController sizing behavior and intrinsicContentSize overridesUIContentConfiguration vs legacy cell configuration (textLabel, imageView)UICollectionViewCompositionalLayout section and item sizingUIContentConfiguration over legacy cell properties for iOS 14+ targets.UICollectionViewCompositionalLayout for new collection view work on iOS 13+.UIHostingController bridging narrow — avoid deep SwiftUI trees inside UIKit containers without explicit sizing.UICollectionViewCompositionalLayout, DiffableDataSource, UIHostingController, scene lifecycleUIContentConfiguration, UIAction-based menus, UIColorPickerViewController, UIListContentConfigurationUISheetPresentationController, UIButton.Configuration, UITableView.sectionHeaderTopPaddingUIHostingConfiguration (SwiftUI cells in UIKit collections), UICalendarView, self-resizing cells by defaultUIContentUnavailableConfiguration, trait registration// iOS 14+: use UIContentConfiguration
func configure(with item: Item) {
var config = UIListContentConfiguration.cell()
config.text = item.title
config.secondaryText = item.subtitle
config.image = UIImage(systemName: item.icon)
contentConfiguration = config
}
// Legacy: direct property access breaks with modern cell lifecycle
func configure(with item: Item) {
textLabel?.text = item.title
detailTextLabel?.text = item.subtitle
imageView?.image = UIImage(systemName: item.icon)
}
func embed(_ child: UIViewController) {
addChild(child)
view.addSubview(child.view)
child.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
child.view.topAnchor.constraint(equalTo: view.topAnchor),
child.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
child.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
child.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])
child.didMove(toParent: self)
}
// Wrong: missing lifecycle calls and constraint setup
func embed(_ child: UIViewController) {
view.addSubview(child.view)
child.view.frame = view.bounds
// Missing: addChild, didMove(toParent:), autoresizing
}