Cómo get el nombre de networking Wi-Fi disponible en iOS usando swift

Quiero que todas las networkinges Wi-Fi estén disponibles en una región y su valor de SSID. Pero el problema es cómo get el SSID de toda la networking WiFi disponible, incluso si no estoy conectado a uno.

Primero;

import SystemConfiguration.CaptiveNetwork

Entonces;

func getInterfaces() -> Bool { guard let unwrappedCFArrayInterfaces = CNCopySupportedInterfaces() else { print("this must be a simulator, no interfaces found") return false } guard let swiftInterfaces = (unwrappedCFArrayInterfaces as NSArray) as? [String] else { print("System error: did not come back as array of Strings") return false } for interface in swiftInterfaces { print("Looking up SSID info for \(interface)") // en0 guard let unwrappedCFDictionaryForInterface = CNCopyCurrentNetworkInfo(interface) else { print("System error: \(interface) has no information") return false } guard let SSIDDict = (unwrappedCFDictionaryForInterface as NSDictionary) as? [String: AnyObject] else { print("System error: interface information is not a string-keyed dictionary") return false } for d in SSIDDict.keys { print("\(d): \(SSIDDict[d]!)") } } return true } 

Aquí mi class que imprime el nombre de la networking WIFI

 import UIKit import Foundation import SystemConfiguration.CaptiveNetwork class FirstView: UIViewController { @IBOutlet weak var label: UILabel! override func viewDidLoad() { super.viewDidLoad() let ssid = self.getWiFiName() print("SSID: \(ssid)") } 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 } }