String

extension String: URLConvertible
  • Returns a URL if the String can be used to initialize a URL, otherwise throws if an error was encountered.

    Throws

    A URLError.invalidURL error.

    Declaration

    Swift

    public func asURL() throws -> URL

    Return Value

    The URL initialized with the String.