One Logo Pool Ball
Network · IOS API REFERENCE

IPv4Address

struct · iOS 12.0+ · SDK 27.1

struct IPv4Address

IPv4Address Base type to hold an IPv4 address and convert between strings and raw bytes. Note that an IPv4 address may be scoped to an interface.

Members (15)

get · iOS 12.0+

isLoopback

TypeScript
getIsLoopback($self: IPv4Address): boolean
Swift declaration
var isLoopback: Bool { get }

Indicates if this IPv4 address is loopback (127.0.0.1)

get · iOS 12.0+

isLinkLocal

TypeScript
getIsLinkLocal($self: IPv4Address): boolean
Swift declaration
var isLinkLocal: Bool { get }

Indicates if this IPv4 address is link-local

get · iOS 12.0+

isMulticast

TypeScript
getIsMulticast($self: IPv4Address): boolean
Swift declaration
var isMulticast: Bool { get }

Indicates if this IPv4 address is multicast

get · iOS 12.0+

allHostsGroup

TypeScript
get allHostsGroup(): IPv4Address
Swift declaration
static let allHostsGroup: IPv4Address

The IPv4 all hosts multicast group

get · iOS 12.0+

allReportsGroup

TypeScript
get allReportsGroup(): IPv4Address
Swift declaration
static let allReportsGroup: IPv4Address

The IPv4 all reports multicast group for ICMPv3 membership reports

get · iOS 12.0+

allRoutersGroup

TypeScript
get allRoutersGroup(): IPv4Address
Swift declaration
static let allRoutersGroup: IPv4Address

The IPv4 all routers multicast group

get · iOS 12.0+

debugDescription

TypeScript
getDebugDescription($self: IPv4Address): 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+

any

TypeScript
get any(): IPv4Address
Swift declaration
static let any: IPv4Address

The IPv4 any address used for listening

get · iOS 12.0+

loopback

TypeScript
get loopback(): IPv4Address
Swift declaration
static let loopback: IPv4Address

The IPv4 loopback address

get · iOS 12.0+

rawValue

TypeScript
getRawValue($self: IPv4Address): ArrayBuffer
Swift declaration
var rawValue: Data { get }

Fetch the raw address (four bytes)

get · iOS 12.0+

broadcast

TypeScript
get broadcast(): IPv4Address
Swift declaration
static let broadcast: IPv4Address

The IPv4 broadcast address used to broadcast to all hosts

get · iOS 12.0+

interface

TypeScript
getInterface($self: IPv4Address): (NWInterface) | null
Swift declaration
let interface: NWInterface?

The interface the address is scoped to, if any.

get · iOS 12.0+

mdnsGroup

TypeScript
get mdnsGroup(): IPv4Address
Swift declaration
static let mdnsGroup: IPv4Address

The IPv4 multicast DNS group. (Note: Use the dns_sd APIs instead of creating your own responder/resolver)

init · iOS 12.0+

init

TypeScript
init(rawValue: ArrayBuffer, interface_?: (NWInterface) | null): (IPv4Address) | null
Swift declaration
init?(_ rawValue: Data, _ interface: NWInterface? = nil)

Create an IPv4 address from a 4-byte data. Optionally specify an interface. - Parameter rawValue: The raw bytes of the IPv4 address, must be exactly 4 bytes or init will fail. - Parameter interface: An optional network interface to scope the address to. Defaults to nil. - Returns: An IPv4Address or nil if the Data parameter did not contain an IPv4 address.

init · iOS 12.0+

init

TypeScript
init46997(string: string): (IPv4Address) | null
Swift declaration
init?(_ string: String)

Create an IPv4 address from an address literal string. This function does not perform host name to address resolution. This is the same as calling getaddrinfo and using AI_NUMERICHOST. - Parameter string: An IPv4 address literal string such as "127.0.0.1", "169.254.8.8%en0". - Returns: An IPv4Address or nil if the string parameter did not contain an IPv4 address literal.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

IPv4Address

The iOS SDK compiler rejected this binding: type 'IPv4Address' does not conform to protocol 'RawRepresentable'

All Network types →