String
extension String: ConfigurationPatternConvertible
extension String: URLConvertible
Support for passing URL patterns with wildcards to Service.configure(...).
-
Matches URLs using shell-like wildcards / globs.
The
urlPatternis 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.
Examples:
/foo/*/barmatches/foo/1/barand/foo/123/bar./foo/**/barmatches/foo/bar,/foo/123/bar, and/foo/1/2/3/bar./foo*/barmatches/foo/barand/food/bar./foo/*matches/foo/123and/foo/./foo/?*matches/foo/123but not/foo/.
The pattern ignores the resource’s query string.
Declaration
Swift
public func configurationPattern(for service: Service) -> (URL) -> Bool -
Returns the URL represented by this string, if it is a valid URL.
Declaration
Swift
public var url: URL? { get }
View on GitHub
String Extension Reference