Master Swift Codable serialization: custom CodingKeys, date/data strategies, polymorphic/lossy decoding, property wrappers for defaults, and bridging with SwiftData/CoreData.
Ships in all-ios-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Encode and decode Swift types with Codable (Encodable & Decodable). Covers custom keys, date/data strategies, polymorphic decoding, default values, and persistence compatibility. Targets Swift 6.4 / iOS 26+.
Map serialized JSON field names to Swift property names using CodingKey:
struct UserProfile: Codable {
let id: UUID
var displayName: String
var emailAddress: String
enum CodingKeys: String, CodingKey {
case id
case displayName = "display_name"
case emailAddress = "email"
}
}
Configure decoder strategies rather than writing manual decoding logic:
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
decoder.dateDecodingStrategy = .iso8601
decoder.dataDecodingStrategy = .base64
let profiles = try decoder.decode([UserProfile].self, from: jsonData)
Note:
.convertFromSnakeCasedoes not handle acronyms well (e.g.server_idbecomesserverId, butserver_urlbecomesserverUrlnotserverURL). Use explicitCodingKeysfor non-standard mappings.
When custom transformations are needed, implement init(from:) and encode(to:):
struct BoundedScore: Codable {
let score: Int
init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let raw = try container.decode(Int.self)
self.score = min(max(raw, 0), 100)
}
func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(score)
}
}
"type") from a parent container, then decode the corresponding concrete type.See references/codable-advanced-patterns.md for complete implementations.
SwiftData @Model classes can store complex structures that conform to Codable. When persisting Codable structs:
CodingKeys, leading to double-conversion mismatches..iso8601 or .millisecondsSince1970.DecodingError.keyNotFound, .typeMismatch, and .valueNotFound details for exact debugging.init(from:) where possibledateDecodingStrategy and keyDecodingStrategy configured on decoderWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
swift-codable, serialization, decoding-strategies, swiftdata
95 skills in this plugin
/accessorysetupkitDiscover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery descriptors for BLE or Wi-Fi devices, handling accessory session events, migrating from CoreBluetooth permission-based scanning, or setting up accessories without requiring broad Bluetooth permissions./activitykitBuild or review Live Activities and Dynamic Island experiences with ActivityKit, including lifecycle, layouts, push updates, and scheduled delivery. Use for time-sensitive Lock Screen or Dynamic Island state; route ordinary widgets to widgetkit./adattributionkitMeasure ad effectiveness with privacy-preserving attribution using AdAttributionKit. Use when registering ad impressions, handling attribution postbacks, updating conversion values, implementing re-engagement attribution, configuring publisher or advertiser apps, or replacing SKAdNetwork with AdAttributionKit for ad measurement./all-ios-skills:swift-codablefrom all-ios-skills
npx claudepluginhub thienqo/ios-skills --plugin all-ios-skillsOther plugins' skills for the same job