Can I detect wifi status on/off in iOS

I want to detect the wifi status at some times, so do you have public api to detect it , I know in android there is one module to manage the wifi. I know there is the Reachability library - only can ensure the network status , but cannot monitor the wifi status-On/Off.

Android wifi manager-[https://developer.android.com/reference/android/net/wifi/WifiManager.AddNetworkResult]

Reachability is deprecated.

You can use NWPathMonitors to monitor the WiFi and Cellular connections.
A closure is called every time the connection status changes.
(The monitoring takes place on a background thread, so you need to dispatch the UI updates on the main thread.)

Setup:

import NetworkExtension

private let monitorWiFi = NWPathMonitor(requiredInterfaceType: .wifi)

Monitor:

monitorWiFi.pathUpdateHandler = { path in
    /// This closure is called every time the connection status changes
    DispatchQueue.main.async {
        switch path.status {
        case .satisfied:
            print("PathMonitor WiFi satisfied, interface: \(path.availableInterfaces) gateways: \(path.gateways)")
        default:
            print("PathMonitor WiFi not satisfied: \(path.unsatisfiedReason)")
        }
    }
}
monitorWiFi.start(queue: DispatchQueue(label: "monitorWiFi"))
Can I detect wifi status on/off in iOS
 
 
Q