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 new And value. This matches URLs 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 URLMatchables creating a new And value. This matches URLs 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 given URL

    Declaration

    Swift

    public func matches(url: URL) -> Bool

    Parameters

    url

    The URL to be matched.

    Return Value

    true if the wrapped collection of URLMatchables all evaluate to true. Otherwise, false.