Scheme
public struct Scheme : Equatable
Type that wraps a validated URL scheme, as per RFC 3986, §3.1.
The value property of a Scheme should be considered safe for use in contexts which require a valid scheme name, as any invalid scheme formulations would be rejected by the contructor.
-
Scheme format errors.
See moreDeclaration
Swift
public enum Format : LocalizedError -
Scheme size errors.
See moreDeclaration
Swift
public enum Size : LocalizedError -
Convienience for http scheme.
Declaration
Swift
public static let http: Scheme -
Convienience for https scheme.
Declaration
Swift
public static let https: Scheme -
Convienience for tel scheme.
Declaration
Swift
public static let tel: Scheme -
Convienience for telPrompt scheme.
Declaration
Swift
public static let telprompt: Scheme -
Convienience for sms scheme.
Declaration
Swift
public static let sms: Scheme -
Convienience for mailto scheme.
Declaration
Swift
public static let mailto: Scheme -
Convienience for webcal scheme.
Declaration
Swift
public static let webcal: Scheme -
Convienience for file scheme.
Declaration
Swift
public static let file: Scheme -
Convienience for ftp scheme.
Declaration
Swift
public static let ftp: Scheme -
A validated scheme, as per RFC 3986, §3.1.
Declaration
Swift
public let value: String -
Creates a
Schemevalue, which holds a validated URL scheme as per RFC 3986, §3.1 (orthrows trying).RFC 952 states “Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (
+
), period (.
), or hyphen (-
).” Any givenschemeincosistent with these rules will cause the initializer tothrow.Additionally, the RFC says “An implementation should accept uppercase letters as equivalent to lowercase in scheme names for the sake of robustness but should only produce lowercase scheme names for consistency.” For this reason, the given
schemeislowercasedbefore validation and storage.Throws
Scheme.Format.invalidCharacterifschemecontains invalid character.Scheme.Size.tooSmallisschemeis zero-length.Declaration
Swift
public init(_ scheme: String) throwsParameters
schemeThe scheme to be validated. Will be stored
lowercased. Will throw an error if invalid.
-
Undocumented
Declaration
Swift
public static var missing: URLMatchable { get } -
Predicate that determines whether a
Schemematches a givenURL.Declaration
Swift
public func matches(url: URL) -> BoolParameters
urlThe
URLto be matched.Return Value
trueifScheme’svalueproperty is equal tourl.scheme. Otherwise,false.
View on GitHub
Install in Dash
Scheme Structure Reference