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