Network Monitoring

  • Use the NetworkMonitor class to determine the current status of the iOS device’s connection to the internet.

    To get the type of network connection currently available, use currentNetworkConnection. If the currentNetworkConnection is WWAN, you can narrow down the type further with cellularNetworkType, which shows whether the device is using 4G, 3G, or 2G.

    To subscribe to network changes, call startMonitoringNetworkChanges() and add an observer to NotificationCenter.default with NetworkMonitor.networkChangedNotificationName as the notification name. To turn off these notifications, call stopMonitoringNetworkChanges().

    See more

    Declaration

    Swift

    public class NetworkMonitor
  • Describes how the device is currently connected to the internet.

    See more

    Declaration

    Swift

    public enum NetworkConnection