Port
public struct Port : URLMatchable
Type that matches a URL based on comparison with the URL’s port propery.
Usage:
let url = URL(string: "https://example.com:8080")!
Port(8080).matches(url) //> true
-
A value that matches a
URLwith aportproperty ofnil.Usage:
let port = URL(string: "http://example.com:8080")! let noPort = URL(string: "http://example.com")! Port.missing.matches(url: port) //> false Port.missing.matches(url: noPort) //> trueDeclaration
Swift
public static let missing: URLMatchable -
Wraps the given number to create a new
Portvalue. It matchesURLs based on theirportproperty.Declaration
Swift
public init(_ port: Int)Parameters
portThe port number to match. It will be compared for equality against
URL’sportproperty. -
Predicate that determines whether a
Portmatches a givenURL.Declaration
Swift
public func matches(url: URL) -> BoolParameters
urlThe
URLto be matched.Return Value
trueif the wrapped port number is equivalent tourl.port. Otherwise,false.
View on GitHub
Install in Dash
Port Structure Reference