PathComponent

enum PathComponent

Represents a path component for use in creating a PathPrefix. A path component can be either a name (which is matched for equality with the strings of a URL’s pathComponents) or a wildcard (which matches any non-nil value):

PathPrefix([.name("/"), .wildcard, .name("bar")])

To reduce noise, PathComponent conforms to ExpressibleByStringLiteral. So the above can be more simply expressed as:

PathPrefix(["/", .wildcard, "foo"])

See also

PathPrefix
  • A path component that matches other path components by string comparison.

    Declaration

    Swift

    case name(String)
  • A path component that matches any non-nil path component.

    Declaration

    Swift

    case wildcard