SuperAPI AI 工具集

axiom-swift-modern

编程与开发

查看项目

更新于 10-15 20:11

技能介绍

用途:在审查或生成 Swift 代码时保证现代惯用法正确性,识别可编译但已过时的 API 与模式。主要能力:给出新旧写法对照,如 Date()→Date.now、filter{}.count→count(where:)、replacingOccurrences(of:with:)→replacing(_:with:)、Task.sleep(nanoseconds:)→Task.sleep(for:)、DateFormatter→.formatted()/FormatStyle、String(format:)→formatted(.number.precision(...))、localizedCaseInsensitiveContains→localizedStandardContains、字符串拼接姓名→PersonNameComponents、appendingPathComponent→appending(path:)、FileManager 目录查询→URL.documentsDirectory;语法简化如 if let value = value→if let value、省略单表达式 return、.circle 静态成员查找;Foundation 现代化与 Comparable 排序;SwiftUI 便利 API(ContentUnavailableView.search、LabeledContent、confirmationDialog 需挂载到触发视图);Swift 6.3 并发取向(默认严格并发与 MainActor 隔离、偏好 async/await 与结构化并发、@concurrent 强制离开主线程、谨慎使用 Task.detached、数据跨隔离用 Sendable 值类型、actor 仅用于真正共享可变状态、@unchecked Sendable 等视为临时桥接)。还列出常见幻觉写法及修正。使用方式:作为技能加载,用于代码审查或生成。限制:具体安装与调用命令资料未提供;价格、平台未提供。