Post

Replies

Boosts

Views

Activity

URLComponents bug in 18.x
Prior to 18.x, this has worked for years. However, if a port is included, the behavior in 18.x is to return "///some/path". In all previous versions it correctly returns "/some/path". Is this a bug, or documented change we missed? func relativeURLString(for urlString: String) -> String? { guard var components = URLComponents(string: urlString) else { return nil } components.host = nil components.scheme = nil // WE FOUND IF YOU NIL THE PORT BEFORE HOST AND SCHEME, IT WORKS components.port = nil return components.string }
4
0
169
1w