Creates an instance initialized to the given string value.
- Parameter value: The value of the new instance.
get · iOS 12.0+
debugDescription
TypeScript
get debugDescription(): string
Swift declaration
var debugDescription: String { get }
A textual representation of this instance, suitable for debugging.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(reflecting:)`
initializer. This initializer works with any type, and uses the custom
`debugDescription` property for types that conform to
`CustomDebugStringConvertible`:
struct Point: CustomDebugStringConvertible {
let x: Int, y: Int
var debugDescription: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `debugDescription` property.
get · iOS 12.0+
interface
TypeScript
get interface(): (NWInterface) | null
Swift declaration
var interface: NWInterface? { get }
Returns the interface the host is scoped to if any
init · iOS 12.0+
init
TypeScript
static init(string: string): NWEndpoint_Host
Swift declaration
init(_ string: String)
Create a host from a string.
This is the preferred way to create a host. If the string is an IPv4 address literal ("198.51.100.2"), an
IPv4 host will be created. If the string is an IPv6 address literal ("2001:DB8::2", "fe80::1%lo", etc), an IPv6
host will be created. If the string is an IPv4 mapped IPv6 address literal ("::ffff:198.51.100.2") an IPv4
host will be created. Otherwise, a named host will be created.
- Parameter string: An IPv4 address literal, an IPv6 address literal, or a hostname.
- Returns: A Host object