Swift SwiftUI
Your Digits-Only TextField Accepts "½". Then Int() Returns nil and the Save Button Does Nothing.
Swift's Character.isNumber is true for ½, Ⅻ, Arabic-Indic and full-width digits, but Int(String) only parses ASCII 0-9. Here's how a numeric TextField filter lets input through that your parser silently rejects, plus the isWholeNumber, ASCII-only and locale-aware fixes, Regex asciiOnlyDigits(), and the tests that catch it.
8 min read
Swift Strings
String(decoding:as:) Never Fails. It Just Quietly Swaps Your Bytes for �.
Swift has two ways to turn bytes into a String and they disagree about failure: String(data:encoding:) returns nil on invalid UTF-8, String(decoding:as:) repairs it with U+FFFD and never tells you. Here's where broken bytes actually come from on iOS (chunked streams, Latin-1 files, BLE packets), how the repair corrupts hashes and signatures, Swift 6's String(validating:as:), and a chunk-safe decoder.
10 min read