And
public struct And : URLMatchable
Type that matches a URL
based on evaluation of its wrapped URLMatchable
s, logically AND’d together.
Usage:
let url = URL(string: "https://example.com/foo")!
And(Scheme.https, Host("example.com")).matches(url) //> true
And(Scheme.https, Path("/foo")).matches(url) //> true
And(Scheme.https, Path("/not-here")).matches(url) //> false
-
Wraps given collection of
URLMatchable
s creating a newAnd
value. This matchesURL
s by evaluating these wrapped matchables and logically AND-ing their results together.Declaration
Swift
public init(_ matchables: URLMatchable...)
Parameters
matchables
The matchables to evaluate and logically AND together to determine the status of a match.
-
Wraps given collection of
URLMatchable
s creating a newAnd
value. This matchesURL
s by evaluating these wrapped matchables and logically AND-ing their results together.Declaration
Swift
public init(_ matchables: [URLMatchable])
Parameters
matchables
The matchables to evaluate and logically AND together to determine the status of a match.
-
Predicate that determines whether an
And
matches a givenURL
Declaration
Swift
public func matches(url: URL) -> Bool
Parameters
url
The
URL
to be matched.Return Value
true
if the wrapped collection ofURLMatchable
s all evaluate totrue
. Otherwise,false
.