When the router is empty, the status is always unsatisfied.
At this time, pathUpdateHandler does not respond even if you switch WiFi ON / OFF.
If the IP address of the connectable device is set to the router, the status will switch to satisfied / unsatisfied by turning WiFi on / off.
Since it is used only in the local area network, the router is not set.
import Network
import SwiftUI
class WiFiNetwork : ObservableObject {
private let wifiMonitor = NWPathMonitor(requiredInterfaceType: .wifi)
func startWiFiMonitor() {
let queue = DispatchQueue(label: "wifiMonitorQueue")
wifiMonitor.pathUpdateHandler = { path in
if path.status == .satisfied {
print("##### WiFi Connected")
} else {
print("##### WiFi not Connected")
}
}
wifiMonitor.start(queue: queue)
}
}
Post
Replies
Boosts
Views
Activity
If you change the iOS language, the device will restart automatically.
At this time, if you acquire the language with the network extension, the language before the change will be acquired.
You must manually restart the device to get the changed language.
let language = NSLocale.preferredLanguages.first?.components(separatedBy: "-").first
This happens on iOS 15.1 and later.
In 15.0.1 I was able to get the changed language.
Is it a bug?