Domain
public struct Domain
Type that wraps a validated domain name (as per RFCs 952 and 1123)
The name
of a Domain
value should be considered safe for use in contexts which require a valid domain name, as any invalid domain formulations would be rejected by the contructor.
-
Domain formatting error.
See moreDeclaration
Swift
public enum Format : LocalizedError
-
Domain size error.
See moreDeclaration
Swift
public enum Size : LocalizedError
-
The validated domain name (as a
String
).Declaration
Swift
public let name: String
-
Creates a new
Domain
value which wraps a validated domain name.And invalid
name
causes the constructor tothrow
.“A ‘name’ (Net, Host, Gateway, or Domain name) is a text string … drawn from the alphabet (A-Z), digits (0-9), minus sign (-) … The first character must be an alpha character. The last character must not be a minus sign.”
and
“The restriction on the first character is relaxed to allow either a letter or a digit. Host software … SHOULD handle host names of up to 255 characters.”
Declaration
Swift
public init(name: String) throws
Parameters
name
The domain name to be wrapped (if validated).