uikit-best-practices
UIKit 最佳实践
本技能提供使用 UIKit 实现 iOS 功能的标准工作流程和最佳实践(Swift 实现)。
核心原则
- 遵循 Apple 官方指南 - 优先参考 Apple Developer Documentation
- ViewController 职责单一 - 每个 ViewController 只负责一个功能模块
- 生命周期意识 - 正确管理
viewDidLoad,viewWillAppear,viewDidAppear等生命周期 - 内存管理 - 使用 ARC,注意循环引用
- 线程安全 - UI 操作必须在主线程,耗时操作在后台线程
实现流程
阶段 1: 需求分析
在写代码之前,明确以下内容:
More from creeveliu/ios-skills
objective-c-language
Objective-C language best practices. Use this skill whenever the user mentions Objective-C, ObjC, OC, working with legacy iOS code, ARC, Blocks, Categories, Protocols, Runtime, or Swift interoperability.
14swiftui-best-practices
How to build iOS interfaces using SwiftUI following best practices. Use this skill whenever the user mentions SwiftUI, building Swift UI, creating views with Swift, state management, @State/@Binding/@ObservedObject, ViewBuilder, or needs guidance on SwiftUI architecture, performance optimization, or UIKit interoperability.
13code-style-guide
iOS code style guide for Swift and Objective-C. Use this skill whenever the user mentions code style, formatting, naming conventions, code organization, Swift/Objective-C coding standards, indentation, comments, or needs to enforce consistent code quality across the project. This skill covers formatting rules, naming patterns, documentation standards, and file organization.
5user-experience
iOS user experience best practices. Use this skill whenever the user mentions UX, user experience, animations, haptic feedback, accessibility, localization, dark mode, or app polish.
4swift-language
Swift language best practices. Use this skill whenever the user mentions Swift programming, Swift syntax, memory management, async/await, generics, protocols, or needs guidance on writing idiomatic Swift code.
4app-stability
iOS app stability and crash prevention best practices. Use this skill whenever the user mentions crashes, stability, exception handling, thread safety, error handling, defensive programming, or app reliability.
4