Instance Property

string

A URL derived from the components object, in string form.

Declaration

var string: String? { get }

Discussion

If the receiver has an authority component (user, password, host, or port) and a path component, then the path must either begin with "/" or be an empty string. Otherwise, this property contains nil.

If the receiver does not have an authority component (user, password, host, or port) and has a path component, the path component must not start with "//". If it does, this property contains nil.

This property can be used only to obtain a URL string based on the values of the other properties. To configure a components object based on an existing URL string, call either the componentsWithString: or init(string:) method.

See Also

Getting the URL

var url: URL?

A URL object derived from the components object.

func url(relativeTo: URL?) -> URL?

Returns a URL object derived from the components object.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software