This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SystemConfiguration.CaptiveNetwork | |
func getWiFiSsid() -> String? { | |
var ssid: String? | |
if let interfaces = CNCopySupportedInterfaces() as NSArray? { | |
for interface in interfaces { | |
if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? { | |
ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String | |
break |