Here’s how to safely create URLs with the lowest reliance on raw strings possible.
It may seem like a lot but we’re basically combining enums with a raw type of String
with URLComponents
. This structure provides a way to individually add the scheme, host, and path components, instead of passing a raw string that could fail.
Instead of relying on a hard-co…
Keep reading with a 7-day free trial
Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.