extension String: ConfigurationPatternConvertible
extension String: URLConvertible

Support for passing URL patterns with wildcards to Service.configure(...).

  • Matches URLs using shell-like wildcards / globs.

    The urlPattern is interpreted relative to the service’s base URL unless it begins with a protocol (e.g. http:). If it is relative, the leading slash is optional.

    The pattern supports three wildcards:

    • * matches zero or more characters within a path segment.
    • ** matches zero or more characters across path segments, with the special case that /​**​/ matches /.
    • ? matches exactly one character within a path segment, and thus ?* matches one or more.


    • /foo/​*​/bar matches /foo/1/bar and /foo/123/bar.
    • /foo/​**​/bar matches /foo/bar, /foo/123/bar, and /foo/1/2/3/bar.
    • /foo*​/bar matches /foo/bar and /food/bar.
    • /foo/​​* matches /foo/123 and /foo/.
    • /foo/?* matches /foo/123 but not /foo/.

    The pattern ignores the resource’s query string.



    public func configurationPattern(for service: Service) -> (URL) -> Bool
  • url

    Returns the URL represented by this string, if it is a valid URL.



    public var url: URL? { get }