Adjust current SSID to also support Catalyst
This commit is contained in:
parent
521c1fd79d
commit
46918a767a
|
@ -109,15 +109,15 @@ public class InterfaceObserver: NSObject {
|
||||||
/**
|
/**
|
||||||
Returns the current Wi-Fi SSID if any.
|
Returns the current Wi-Fi SSID if any.
|
||||||
|
|
||||||
- Returns: The current Wi-Fi SSID if any.
|
- Parameter completionHandler: Receives the current Wi-Fi SSID if any.
|
||||||
**/
|
**/
|
||||||
public static func fetchCurrentSSID(completionHandler: @escaping (String?) -> Void) {
|
public static func fetchCurrentSSID(completionHandler: @escaping (String?) -> Void) {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
// if #available(iOS 14.0, *) {
|
if #available(iOS 14, macCatalyst 14, *) {
|
||||||
// NEHotspotNetwork.fetchCurrent {
|
NEHotspotNetwork.fetchCurrent {
|
||||||
// completionHandler($0?.ssid)
|
completionHandler($0?.ssid)
|
||||||
// }
|
}
|
||||||
// } else {
|
} else if #available(macCatalyst 14, *) {
|
||||||
guard let interfaceNames = CNCopySupportedInterfaces() as? [CFString] else {
|
guard let interfaceNames = CNCopySupportedInterfaces() as? [CFString] else {
|
||||||
completionHandler(nil)
|
completionHandler(nil)
|
||||||
return
|
return
|
||||||
|
@ -132,7 +132,9 @@ public class InterfaceObserver: NSObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
completionHandler(nil)
|
completionHandler(nil)
|
||||||
// }
|
} else {
|
||||||
|
completionHandler(nil)
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
let client = CWWiFiClient.shared()
|
let client = CWWiFiClient.shared()
|
||||||
let ssid = client.interfaces()?.compactMap { $0.ssid() }.first
|
let ssid = client.interfaces()?.compactMap { $0.ssid() }.first
|
||||||
|
|
Loading…
Reference in New Issue