PathPattern

public class PathPattern : ExpressibleByStringLiteral, Hashable

Path pattern definition for pattern matching

let pathPattern: PathPattern = "/my/{adjective}/string/{number}"

pathPattern.matches("/my/cool/string/1")       // `true`
pathPattern.matches("/my/awesome/string/2")    // `true`
pathPattern.matches("/your/cool/string/3")     // `false`, mismatch on expected static element first
pathPattern.matches("/my/cool/string/hello")   // `true`

Properties

  • Get the individual parts

    Declaration

    Swift

    public lazy var components: [PathPattern.Component] { get set }

Methods

  • Initialize with string literal

    let pattern: PathPattern = "/check/{this}/out"
    

    Declaration

    Swift

    required public init(stringLiteral: String)

Hashable

  • Hashable based on rawValue

    Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Compares on raw strings

    Declaration

    Swift

    public static func == (lhs: PathPattern, rhs: PathPattern) -> Bool
  • Path pattern component for pattern matching.

    See more

    Declaration

    Swift

    public enum Component