Instance Property
percentEncodedHost
iOS 8.0+Deprecated
iPadOS 8.0+Deprecated
Mac Catalyst 8.0+Deprecated
macOS 10.10+Deprecated
tvOS 9.0+Deprecated
visionOS 1.0+Deprecated
watchOS 2.0+Deprecated
Deprecated
Use encodedHost instead
The host subcomponent, percent-encoded.
var percentEncodedHost: String? { get set }
Discussion
The getter for this property retains any percent encoding this component may have. Setting this properties assumes the component string is already correctly percent encoded. Attempting to set an incorrectly percent encoded string will cause a fatalError.
Although ‘;’ is a legal path character, it is recommended that it be percent-encoded for best compatibility with URL (String.addingPercentEncoding(withAllowedCharacters:) will percent-encode any ‘;’ characters if you pass CharacterSet.urlHostAllowed).