Modern URL construction in Swift

How to combine Foundation’s latest URL APIs with Swift features like macros, to be able to work with both static and dynamic URLs in simpler and more predictable ways.