Parameter

public struct Parameter
extension Route.Parameter: Hashable
extension Route.Parameter: CustomStringConvertible

An extracted parameter from the path of Route.

  • A unique name.

    Declaration

    Swift

    public let name: String
  • A validated value by the requirement.

    Declaration

    Swift

    public var value: String
  • A regular expression for the value.

    Declaration

    Swift

    public let requirement: String
  • A default value if the value is missing.

    Declaration

    Swift

    public let defaultValue: DefaultValue?
  • Initializes a new instance or nil.

    Warning

    It may return nil if the name is missing, the value doesn’t conform to the requirement, the requirement is invalid or the default value is invalid.

    Declaration

    Swift

    public init?(name: String, value: String = "", requirement: String = "", defaultValue: DefaultValue? = nil)

    Parameters

    name

    A unique name.

    value

    A validated value by the requirement.

    requirement

    A regular expression for the value.

    defaultValue

    A default value if the value is missing.

  • A default value for the parameter.

    See more

    Declaration

    Swift

    public enum DefaultValue : CustomStringConvertible, Equatable
  • A generated pattern for the parameter.

    Declaration

    Swift

    public var pattern: String { get }
  • See Equatable.

    Declaration

    Swift

    public static func == (lhs: Route.Parameter, rhs: Route.Parameter) -> Bool
  • See Hashable.

    Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • See CustomStringConvertible.

    Declaration

    Swift

    public var description: String { get }