URL

    A URL is a type that can potentially contain the location of a resource on a remote server, the path of a local file on disk, or even an arbitrary piece of encoded data.

    iOS
    8.0+
    macOS
    10.10+
    tvOS
    9.0+
    watchOS
    2.0+
    struct URL

    You can construct URLs and access their parts. For URLs that represent local files, you can also manipulate properties of those files directly, such as changing the file’s last modification date. Finally, you can pass URLs to other APIs to retrieve the contents of those URLs. For example, you can use the URLSession classes to access the contents of remote resources, as described in URL Session Programming Guide.

    URLs are the preferred way to refer to local files. Most objects that read data from or write data to a file have methods that accept a URL instead of a pathname as the file reference. For example, you can get the contents of a local file URL as String by calling func init(contentsOf:encoding:) throws, or as a Data by calling func init(contentsOf:options:) throws.

    Citizens in FoundationEssentials

    Conformances

    Types

    Type members

    Instance members

    Type features

    Available in Foundation

    Conformances

    Typealiases

    Type members

    Instance members

    Extension in AsyncHTTPClient

    Type members

    • init?(httpURLWithSocketPath: String, uri: String)

      Initializes a newly created HTTP URL connecting to a unix domain socket path. The socket path is encoded as the URL’s host, replacing percent encoding invalid path characters, and will use the “http+unix” scheme.

    • init?(httpsURLWithSocketPath: String, uri: String)

      Initializes a newly created HTTPS URL connecting to a unix domain socket path over TLS. The socket path is encoded as the URL’s host, replacing percent encoding invalid path characters, and will use the “https+unix” scheme.