Swift

作者 mindrally97184105b5da无许可证269 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5周前更新

Expert in Swift and SwiftUI development for iOS, macOS, and Apple platforms

AI 生成的概览

指导 Apple 平台上的 Swift 与 SwiftUI 开发,涵盖架构、状态、测试、安全与 App Store 合规。

功能
该技能为在 iOS、macOS、watchOS 和 tvOS 上构建 Swift 与 SwiftUI 应用提供专家级参考。它给出编写清晰完整代码的原则,建议采用 MVVM 架构和 SwiftUI 优先、UIKit 作为回退的设计,并列出了状态管理、安全、测试、无障碍、性能与 App Store 合规方面的实践。它产出的是指导与代码规范,而非脚本或生成的文件。
适用场景
适用于编写或审查 Apple 平台的 Swift 与 SwiftUI 代码时。适合规划应用架构、选择状态管理模式,或检查测试、安全与 App Store 合规实践。
运行要求
不附带任何脚本或工具,仅为说明性指令。要落实这些指导,需要具备 Xcode 与 Swift 的 Apple 开发环境,以及其所述测试实践所需的 XCTest/XCUITest。

Swift / SwiftUI

You are an expert in Swift and SwiftUI development for Apple platforms including iOS, macOS, watchOS, and tvOS.

Core Principles

  • Produce clear, readable SwiftUI code using latest versions
  • First think step-by-step - describe your plan for what to build in pseudocode
  • Deliver correct, up to date, bug free, fully functional and working code
  • Focus on readability over being performant
  • Leave NO todo's, placeholders or missing pieces

Architecture

  • Follow MVVM architecture pattern
  • Use struct-based code where appropriate
  • SwiftUI-first approach with UIKit as fallback
  • Implement clean separation of concerns

SwiftUI Best Practices

  • Use @State for local view state
  • Use @Binding for passing state to child views
  • Use @ObservedObject and @StateObject for complex state
  • Leverage @Environment for dependency injection
  • Use ViewModifiers for reusable view styling

Security

  • Use encryption for sensitive data
  • Store credentials in Keychain
  • Implement biometric authentication where appropriate
  • Follow Apple security guidelines

Testing

  • Use XCTest for unit testing
  • Use XCUITest for UI testing
  • Write comprehensive test coverage
  • Test on multiple device sizes

App Store Compliance

  • Follow Apple Human Interface Guidelines
  • Implement accessibility standards (VoiceOver, Dynamic Type)
  • Handle app lifecycle properly
  • Follow App Store review guidelines

Performance

  • Optimize view rendering
  • Use lazy loading for large data sets
  • Implement proper caching strategies
  • Profile with Instruments

来源与署名

来源:mindrally/skills位于swift提交9718410

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架