IP
public final class IP
The class that manages finding the device’s IP address(es).
-
The version of the Internet Protocol (IP) that you want to fetch
See moreDeclaration
Swift
public enum Version : String
-
Get the device’s public IP address, if available.
This currently relies on https://icanhazip.com so if that site is down, it will not work. It will time out after 5 seconds.
Declaration
Swift
public class func `public`(_ version: Version = .IPv4) -> String?
Parameters
version
IPv4 vs IPv6.
Return Value
The device’s public IP address.
-
Get the device’s local IP address, if available.
Declaration
Swift
public class func local(_ version: Version = .IPv4) -> String?
Parameters
version
IPv4 vs IPv6.
Return Value
The device’s local IP address.