Skip to content

Instantly share code, notes, and snippets.

@MrCrambo
Last active May 24, 2020 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrCrambo/54a1bd8a54243a463573b574a01fcb3c to your computer and use it in GitHub Desktop.
Save MrCrambo/54a1bd8a54243a463573b574a01fcb3c to your computer and use it in GitHub Desktop.
func getWiFiName() -> 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
}
}
}
return ssid
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment