Calendar.current Isn't Always Gregorian. In Thailand, It's the Year 2569.
Calendar.current follows the user's chosen calendar, so on a phone set to the Buddhist or Japanese calendar, component(.year) returns 2569 or 8 instead of 2026. Here's how that breaks card expiry checks, age gates, filenames, and date math in Swift apps, and how to fix it with an explicit Gregorian calendar.
URL(string:) Stopped Returning nil for Garbage in iOS 17. Your Validation Still Trusts It.
Since iOS 17, URL(string:) percent-encodes invalid characters instead of returning nil, so 'guard let url = URL(string: input)' accepts almost any text as a valid URL. Here's what changed, why it only kicked in when you updated Xcode, and how to validate URLs properly in Swift with scheme and host checks and URL(string:encodingInvalidCharacters:).
You Shipped a Turkish Localization. Now "INFO" Lowercases to "ınfo" and Your String Matching Is Broken.
localizedLowercase and lowercased(with: .current) follow Turkish casing rules, where I lowercases to dotless ı and i uppercases to dotted İ. Here's how that breaks enum parsing, email normalization, file extensions and dictionary keys in Swift apps, why it only shows up after you add a Turkish localization, and the rule that fixes it.
FileManager Says Your File Doesn't Exist. It's Right There. URL.path() Added %20 to the Name.
URL.path() returns a percent-encoded path by default, so FileManager.fileExists(atPath:) returns false for any file with a space or an accent in its name. Here's why path() and the old path property disagree, how it silently creates duplicate files, and how to fix file URL handling in Swift for good.
Your Binary Parser Passed Every Test. Then data[0] Crashed in Production Because the Slice Started at 4.
In Swift, a Data slice keeps the indices of the original buffer. After dropFirst, prefix(upTo:) or a range subscript, data[0] is out of bounds and crashes. Here's why Data is its own SubSequence, why tests built from fresh Data never catch it, and how to write byte parsers that work on any slice.
You Saved the User's Birthday as a Date. Now It's a Day Early for Everyone in America.
A birthday, due date, or all-day deadline is a calendar day, not a moment in time. Storing it as a Swift Date pins it to midnight in one time zone, so it shifts by a day when the user travels or when your server parses "1990-03-05" as UTC. Here's why it happens, the LocalDate struct that fixes it, the noon hack that almost works, and the test that proves it.
Your Date Parsing Works on Every Test Device. Then One User Turns Off 24-Hour Time.
A fixed-format DateFormatter in Swift respects the user's 12/24-hour override, so a perfectly good server timestamp can come back nil for a handful of users. Here's why Apple's QA1480 bug still bites iOS apps, why en_US_POSIX is the fix, the time zone trap hiding next to it, and how to switch machine dates to ISO8601FormatStyle.
UserDefaults.bool(forKey:) Returns false for a Key You Never Set. Your 'On by Default' Setting Ships Off.
UserDefaults.bool(forKey:) can't tell 'the user turned this off' from 'nobody has ever touched this', so every setting that's supposed to default to true quietly starts as false. Here's why, how register(defaults:) fixes it, why the @AppStorage inline default only fixes it for one view, and the widget and first-launch traps sitting right next to it.
Adding 86,400 Seconds Isn't Adding a Day. Twice a Year Your Streak Counter Finds Out.
A day isn't always 86,400 seconds long. Daylight saving transitions make it 23 or 25 hours, which quietly breaks streak counters, 'last 7 days' queries, and repeating reminders. Here's why Calendar exists and how to do date math that survives March.
Your Receipt Says $0.13. Your Label Says $0.12. Swift Has Two Rounding Rules and You're Using Both.
Swift's Double.rounded() rounds half away from zero, but NumberFormatter, FormatStyle, and String(format:) round half to even. Here's why the same number displays two ways, the 1.005 trap, and how to pick one rounding rule and enforce it.
Your DateFormatter Says It's Next Year. Capital YYYY Isn't the Year You Think It Is.
In a DateFormatter pattern, YYYY is the week-based year, not the calendar year. For a few days around New Year it prints the wrong year, breaking receipts, filenames, cache keys, and API payloads. Here's why, which dates it hits per locale, and how to catch it before December does.
You Switched Your Prices to Decimal. Decimal(0.1) Still Went Through a Double First.
Swift's Decimal fixes binary floating-point money bugs, until you build one from a Double or a float literal. Here's why Decimal(0.1) can carry the exact error you were trying to escape, and the initializers that actually give you exact cents.
You're Creating a New DateFormatter on Every Cell Scroll. That's the Lag You Can't Explain.
DateFormatter and ISO8601DateFormatter are expensive to initialize — locale and calendar setup included — and creating one inside a loop or a SwiftUI view body is a quiet, common performance bug. Here's the actual cost and the fix.