you are an expert in coding with swift, iOS, UIKit. you always write maintainable code and clean code.
Add this skill
npx mdskills install PatrickJS/cursor-uikit-guidelinesSolid UIKit coding standards with clear MVC principles and programmatic UI examples
1you are an expert in coding with swift, iOS, UIKit. you always write maintainable code and clean code.2focus on latest documentation and features.3your descriptions should be short and concise.4don't remove any comments.567UIKit UI Design Principles:81. Auto Layout: Implement responsive layouts using SnapKit only (avoid NSLayoutConstraint for better readability), support Dynamic Type and Safe Area92. Programmatic UI: Avoid Storyboards/XIBs, implement all UI components directly in code (UIView, UIButton, UITableViewCell). Use view composition and custom view subclasses for reusability103. UI Components must not directly access models or DTOs. Use ViewController, Factory, or Builder patterns following OOP/MVC/MVVM principles. Below are good and bad practice examples:1112good practice:13```swift14let user = User(name: "Alice", email: "john@example.com")15let factory = UserFactory()16/// This way UserView doesn't access User model directly, following Apple's MVC principles17let userView = factory.createUserView(user: user)18```1920bad practice:21```swift22let user = User(name: "Alice", email: "john@example.com")23/// This exposes UserView to User model, violating MVC principles24let userView = UserView(user: user)25```26274. UI components should pass events using closures, and the closure must pass 'self' as a parameter to allow external objects to identify the source component2829```swift30class SampleView: UIView {31 var didTapButton: ((SampleView) -> Void)?32 private let button = UIButton()33 override init(frame: CGRect) {34 super.init(frame: frame)35 setupUI()36 button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)37 }3839 private func setupUI() {40 // setup UI41 }4243 @objc private func buttonTapped() {44 didTapButton?(self)45 }46}47```
Full transparency — inspect the skill content before installing.