And
public struct And : URLMatchable
Type that matches a URL based on evaluation of its wrapped URLMatchables, 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
URLMatchables creating a newAndvalue. This matchesURLs by evaluating these wrapped matchables and logically AND-ing their results together.Declaration
Swift
public init(_ matchables: URLMatchable...)Parameters
matchablesThe matchables to evaluate and logically AND together to determine the status of a match.
-
Wraps given collection of
URLMatchables creating a newAndvalue. This matchesURLs by evaluating these wrapped matchables and logically AND-ing their results together.Declaration
Swift
public init(_ matchables: [URLMatchable])Parameters
matchablesThe matchables to evaluate and logically AND together to determine the status of a match.
-
Predicate that determines whether an
Andmatches a givenURLDeclaration
Swift
public func matches(url: URL) -> BoolParameters
urlThe
URLto be matched.Return Value
trueif the wrapped collection ofURLMatchables all evaluate totrue. Otherwise,false.
View on GitHub
Install in Dash
And Structure Reference