URL

struct URL : ReferenceConvertible, Equatable
  • Constants indicating a filename’s extension.

    Only a few common filename extensions are defined here. Over time, as the number of uunique use cases grows, it is expected that more filename extensions will be defined here.

    See more

    Declaration

    Swift

    enum ExtensionType : String
  • An ExtensionType value representation of the URL’s path extension.

    For URLs that do not have a discernable path extension, an ExtensionType value of none is returned.

    Declaration

    Swift

    var extensionType: ExtensionType? { get }
  • Localized or extension-hidden name as displayed to users.

    Declaration

    Swift

    var localizedName: String? { get }
  • Uniform type identifier (UTI) for the resource.

    Declaration

    Swift

    var typeIdentifier: String? { get }
  • An object that decodes instances of data types from decodable objects.

    If the URL’s path extension has a defined ExtensionType value that maps to decoder that conforms to the AnyDecoder protocol, then a decoder appropriate for that path extension is returned. Otherwise, a nil value is returned.

    Declaration

    Swift

    var decoder: AnyDecoder? { get }
  • An object that decodes instances of data types from decodable objects.

    If the URL’s path extension has a defined ExtensionType value that maps to decoder that conforms to the AnyDecoder protocol, then a decoder appropriate for that path extension is returned. Otherwise, a nil value is returned.

    Declaration

    Swift

    var encoder: AnyEncoder? { get }
  • Directly decodes any Decodable object using, when defined, the decoder associated with the URL’s path extension.

    This generic instance method returns a type-inferred value, decoded from an object adopting the Decodable protocol.

    Declaration

    Swift

    func decoded<T>() throws -> T? where T : Decodable

    Return Value

    A decoded object adopting the Decodable protocol.

  • Declaration

    Swift

    public var stem: String? { get }
  • Declaration

    Swift

    public var `extension`: String? { get }