I know it's not possible to get all available Wi-Fi networks and it's possible to get the information of current connected Wi-Fi network, correct me if I'm wrong.
I just want to know the feasibility of getting the information of all previously connected Wi-Fi networks, Please help me by sharing your experience.
FYI,
I'm using the following code get current connected Wi-Fi network's info and it's working fine.
var currentSSID: String!
let interfaces:CFArray! = CNCopySupportedInterfaces()
for i in 0..<CFArrayGetCount(interfaces) {
let interfaceName: UnsafePointer<Void>
= CFArrayGetValueAtIndex(interfaces, i)
let rec = unsafeBitCast(interfaceName, AnyObject.self)
let unsafeInterfaceData = CNCopyCurrentNetworkInfo("\(rec)")
if unsafeInterfaceData != nil {
let interfaceData = unsafeInterfaceData! as Dictionary!
currentSSID = interfaceData["SSID"] as! String
} else {
currentSSID = ""
}
print(currentSSID)
}