Or

public struct Or : URLMatchable

Type that matchies a URL based on evaluation of its wrapped URLMatchables, 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 URLMatchables creating a new Or value. This matches URLs 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 URLMatchables creating a new Or value. This matches URLs 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 given URL

    Declaration

    Swift

    public func matches(url: URL) -> Bool

    Parameters

    url

    The URL to be matched.

    Return Value

    true if any of the wrapped collection of URLMatchables evaluates to true. Otherwise, false.