Foundation
-
Fix: ISO 8601 Fractional Seconds Date Parsing in Swift
Fix ISO 8601 and RFC 3339 fractional seconds parsing in Swift using Date.ISO8601FormatStyle, ISO8601DateFormatter, and custom Codable strategies.
-

Fix: Int Missing Leading Zeros When Converted to String in Swift
Learn how to format integers with leading zeros in Swift using String format initializers and NumberFormatter.
-
How to Save Strings to UserDefaults in SwiftUI and Swift
Learn how to save, read, and remove strings in UserDefaults using Swift, SwiftUI @AppStorage, and Objective-C without deprecated synchronize calls.
-
How to Extract Regex Matches in Swift Without NSRange Errors
Learn how to extract regex matches from a String in Swift using native Regex, NSRegularExpression, and safe Range conversions for Unicode text.
-

How to Generate a UUID in SwiftUI
Generate UUIDs in Swift and SwiftUI with Foundation, convert them to strings, and keep table keys and list identities stable across updates…
-
How to Throw a Custom Error Message in Swift Without Boilerplate
Learn how to throw an error with a custom string message in Swift using LocalizedError structs, single-case enums, String extensions, or NSError.
-

How to Trim Whitespace From a String in Swift
Learn how to trim leading and trailing whitespace and newlines from a String in Swift using trimmingCharacters(in:), custom extensions, and pure Swift.
-

How to Convert NSURL to NSString in Objective-C and Swift
Learn how to convert NSURL to NSString in Objective-C and URL to String in Swift using absoluteString or path, and avoid common…
-

How to Add 1 Day to a Date Using Swift’s Calendar API
Add one day to a Date in Swift with Calendar.date(byAdding:), handle month and year rollover and DST correctly, plus Objective-C and reusable…
-

How to Get a Substring by Range Using String.Index
substringWithRange is gone from Swift. Learn how to slice a String with String.Index ranges, prefix/suffix, NSRange conversion, and a safe Int-offset helper.