Your Request Signature Fails on One Request in Ten. JSONEncoder Never Promised You the Same Bytes.
Signing a JSON body with HMAC in Swift breaks when you encode twice, when a Dictionary changes key order, or when JSONEncoder escapes slashes as \/. Here's why JSONEncoder output isn't canonical, how it breaks webhook and API signatures, and the fix: sign the exact Data you send.
Your Backend Added One Enum Case. Every User on the Old App Build Got an Empty Screen.
A Swift enum with a String raw value and synthesized Codable throws on any value it doesn't know, and that one throw takes down the whole object and the whole array around it. Here's how a harmless server-side addition empties your iOS app, the unknown-case and other(String) fixes, the encode-back trap, and the test that catches it before the App Store does.
JSONEncoder Sends Your Dates as Seconds Since 2001. Your Backend Thinks It's 1995.
Swift's JSONEncoder defaults to .deferredToDate, which encodes Date as a Double counting seconds from January 1, 2001, not 1970. Here's why round-trip tests never catch it, what it does to Node, Python and Go backends, and how to pin one date strategy for your whole app.
Codable Can't Tell You the Difference Between null and a Missing Key. Your PATCH Endpoint Can.
decodeIfPresent collapses an explicit JSON null and an absent key into the same nil, which makes 'clear this field' and 'leave it alone' indistinguishable. Here's the three-state wrapper that keeps them apart, and when you actually need it.
Swift's uuidString Is Uppercase. Your Backend's UUIDs Aren't. Every String Comparison Between Them Fails.
UUID().uuidString returns uppercase hex while Postgres, JavaScript and Python emit lowercase, so string comparisons, dictionary keys, cache file names and Set deduplication silently miss. Here's where it bites in iOS apps and how to keep UUIDs typed until the boundary.
Codable's Snake Case Conversion Looks Like Free API Mapping. It Breaks on the First Acronym.
JSONEncoder's .convertToSnakeCase and JSONDecoder's .convertFromSnakeCase promise to erase the naming gap between Swift and your API. They do — right up until a property has an acronym in it, and then they fail silently on Optional fields instead of throwing.
One Bad Element in Your JSON Array Can Freeze Your App Forever. Swift Wants to Fix It.
A fresh Swift Evolution pitch adds skip() to UnkeyedDecodingContainer, fixing a real Codable footgun: the 'decode what you can, skip what you can't' loop that looks correct and hangs at runtime.