StructureFoundation5.9.0
URLComponents
A structure designed to parse URLs based on RFC 3986 and to construct URLs from their constituent parts.
struct URLComponents
Its behavior differs subtly from the URL
struct, which conforms to older RFCs. However, you can easily obtain a URL
based on the contents of a URLComponents
or vice versa.
Citizens in Foundation
Conformances
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomReflectable
A type that explicitly supplies its own mirror.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol ReferenceConvertible
Decorates types which are backed by a Foundation reference type.
Members
init(
) Initialize with all components undefined.
init(from: Decoder
) throws init?(string: String
) Initialize with a URL string.
init?(url: URL, resolvingAgainstBaseURL: Bool
) Initialize with the components of a URL.
var customMirror: Mirror
var debugDescription: String
var description: String
var fragment: String?
The fragment subcomponent.
var host: String?
The host subcomponent.
var password: String?
The password subcomponent of the URL.
var path: String
The path subcomponent.
var percentEncodedFragment: String?
The fragment subcomponent, percent-encoded.
var percentEncodedHost: String?
The host subcomponent, percent-encoded.
var percentEncodedPassword: String?
The password subcomponent, percent-encoded.
var percentEncodedPath: String
The path subcomponent, percent-encoded.
var percentEncodedQuery: String?
The query subcomponent, percent-encoded.
var percentEncodedQueryItems: [URLQueryItem]?
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 retainedvar percentEncodedUser: String?
The user subcomponent, percent-encoded.
var port: Int?
The port subcomponent.
var query: String?
The query subcomponent.
var queryItems: [URLQueryItem]?
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>?
Returns the character range of the fragment in the string returned by
var string
.var rangeOfHost: Range<String.Index>?
Returns the character range of the host in the string returned by
var string
.var rangeOfPassword: Range<String.Index>?
Returns the character range of the password in the string returned by
var string
.var rangeOfPath: Range<String.Index>?
Returns the character range of the path in the string returned by
var string
.var rangeOfPort: Range<String.Index>?
Returns the character range of the port in the string returned by
var string
.var rangeOfQuery: Range<String.Index>?
Returns the character range of the query in the string returned by
var string
.var rangeOfScheme: Range<String.Index>?
Returns the character range of the scheme in the string returned by
var string
.var rangeOfUser: Range<String.Index>?
Returns the character range of the user in the string returned by
var string
.var scheme: String?
The scheme subcomponent of the URL.
var string: String?
var url: URL?
Returns a URL created from the URLComponents.
var user: String?
The user subcomponent of the URL.
static func == (URLComponents, URLComponents
) -> Bool func encode(to: Encoder
) throws func hash(into: inout Hasher
) func url(relativeTo: URL?
) -> URL? Returns a URL created from the URLComponents relative to a base URL.
typealias ReferenceType