·codable-patterns
</>

codable-patterns

使用 Codable、JSONEncoder 和 JSONDecoder 对 Swift 类型与 JSON、属性列表和其他外部表示进行编码和解码。在实现API响应解析、用于键重新映射的自定义CodingKeys、用于复杂转换的自定义init(from:)或encode(to:)、嵌套或扁平化JSON结构、异构数组解码、日期和数据解码策略、有损数组包装器、与URLSession、SwiftData或UserDefaults的可编码集成时使用,或者在配置编码器/解码器输出格式和键策略时使用。

55安装·27热度·@dpearson2699

安装

$npx skills add https://github.com/dpearson2699/swift-ios-skills --skill codable-patterns

如何安装 codable-patterns

通过命令行快速安装 codable-patterns AI 技能到你的开发环境

  1. 打开终端: 打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等)
  2. 运行安装命令: 复制并运行以下命令:npx skills add https://github.com/dpearson2699/swift-ios-skills --skill codable-patterns
  3. 验证安装: 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用

来源:dpearson2699/swift-ios-skills。

SKILL.md

查看原文

Encode and decode Swift types using Codable (Encodable & Decodable) with JSONEncoder, JSONDecoder, and related APIs. Targets Swift 6.2 / iOS 26+.

When all stored properties are themselves Codable, the compiler synthesizes conformance automatically:

Prefer Decodable for read-only API responses and Encodable for write-only. Use Codable only when both directions are required.

使用 Codable、JSONEncoder 和 JSONDecoder 对 Swift 类型与 JSON、属性列表和其他外部表示进行编码和解码。在实现API响应解析、用于键重新映射的自定义CodingKeys、用于复杂转换的自定义init(from:)或encode(to:)、嵌套或扁平化JSON结构、异构数组解码、日期和数据解码策略、有损数组包装器、与URLSession、SwiftData或UserDefaults的可编码集成时使用,或者在配置编码器/解码器输出格式和键策略时使用。 来源:dpearson2699/swift-ios-skills。

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill codable-patterns
分类
</>开发工具
认证
收录时间
2026-03-09
更新时间
2026-03-11

Browse more skills from dpearson2699/swift-ios-skills

快速解答

什么是 codable-patterns?

使用 Codable、JSONEncoder 和 JSONDecoder 对 Swift 类型与 JSON、属性列表和其他外部表示进行编码和解码。在实现API响应解析、用于键重新映射的自定义CodingKeys、用于复杂转换的自定义init(from:)或encode(to:)、嵌套或扁平化JSON结构、异构数组解码、日期和数据解码策略、有损数组包装器、与URLSession、SwiftData或UserDefaults的可编码集成时使用,或者在配置编码器/解码器输出格式和键策略时使用。 来源:dpearson2699/swift-ios-skills。

如何安装 codable-patterns?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/dpearson2699/swift-ios-skills --skill codable-patterns 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用

这个 Skill 的源码在哪?

https://github.com/dpearson2699/swift-ios-skills