Skip to content

Instantly share code, notes, and snippets.

Avatar

Ki LeftOverCoder

  • Sacramento CA
View GitHub Profile
@werediver
werediver / WiFiSsid.swift
Created Jul 14, 2016
Get the connected Wi-Fi network SSID on iOS (in Swift).
View WiFiSsid.swift
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