Swift Foundation
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:).
9 min read
Swift Foundation
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.
8 min read