==(_:_:)
- iOS
- 8.0+
- macOS
- 10.10+
- tvOS
- 9.0+
- watchOS
- 2.0+
static func == (lhs: URLComponents, rhs: URLComponents) -> Bool
static func == (lhs: URLComponents, rhs: URLComponents) -> Bool
s20FoundationEssentials13URLComponentsV2eeoiySbAC_ACtFZ
What are these?6745N
import FoundationEssentials
struct URLComponents
A structure designed to parse URLs based on RFC 3986 and to construct URLs from their constituent parts.
@frozen struct Bool
A value type whose instances are either true
or false
.
init()
Initialize with all components undefined.
init(from decoder: any Decoder) throws
init?(string: String)
Initialize with a URL string.
init?(string: String, encodingInvalidCharacters: Bool)
Initialize with a URL string and the option to add (or skip) IDNA- and percent-encoding of invalid characters. If encodingInvalidCharacters
is false, and the URL string is invalid according to RFC 3986, nil
is returned. If encodingInvalidCharacters
is true, URLComponents
will try to encode the string to create a valid URL. If the URL string is still invalid after encoding, nil
is returned.
init?(url: URL, resolvingAgainstBaseURL resolve: Bool)
Initialize with the components of a URL.
var customMirror: Mirror { get }
var debugDescription: String { get }
var description: String { get }
var encodedHost: String? { get set }
var fragment: String? { get set }
The fragment subcomponent.
var host: String? { get set }
The host subcomponent.
var password: String? { get set }
The password subcomponent of the URL.
var path: String { get set }
The path subcomponent.
var percentEncodedFragment: String? { get set }
The fragment subcomponent, percent-encoded.
var percentEncodedHost: String? { get set }
The host subcomponent, percent-encoded.
var percentEncodedPassword: String? { get set }
The password subcomponent, percent-encoded.
var percentEncodedPath: String { get set }
The path subcomponent, percent-encoded.
var percentEncodedQuery: String? { get set }
The query subcomponent, percent-encoded.
var percentEncodedQueryItems: [URLQueryItem]? { get set }
Returns an array of query items for this URLComponents
, in the order in which they appear in the original query string. Any percent-encoding in a query item name or value is retained
var percentEncodedUser: String? { get set }
The user subcomponent, percent-encoded.
var port: Int? { get set }
The port subcomponent.
var query: String? { get set }
The query subcomponent.
var queryItems: [URLQueryItem]? { get set }
Returns an array of query items for this URLComponents
, in the order in which they appear in the original query string.
var rangeOfFragment: Range<String.Index>? { get }
Returns the character range of the fragment in the string returned by var string
.
var rangeOfHost: Range<String.Index>? { get }
Returns the character range of the host in the string returned by var string
.
var rangeOfPassword: Range<String.Index>? { get }
Returns the character range of the password in the string returned by var string
.
var rangeOfPath: Range<String.Index>? { get }
Returns the character range of the path in the string returned by var string
.
var rangeOfPort: Range<String.Index>? { get }
Returns the character range of the port in the string returned by var string
.
var rangeOfQuery: Range<String.Index>? { get }
Returns the character range of the query in the string returned by var string
.
var rangeOfScheme: Range<String.Index>? { get }
Returns the character range of the scheme in the string returned by var string
.
var rangeOfUser: Range<String.Index>? { get }
Returns the character range of the user in the string returned by var string
.
var scheme: String? { get set }
The scheme subcomponent of the URL.
var string: String? { get }
Returns a URL string created from the URLComponents.
var url: URL? { get }
Returns a URL created from the URLComponents.
var user: String? { get set }
The user subcomponent of the URL.
func encode(to encoder: any Encoder) throws
func hash(into hasher: inout Hasher)
func url(relativeTo base: URL?) -> URL?
Returns a URL created from the URLComponents relative to a base URL.