In Mavericks, I used [CWInterface interface]to capture the current network. This means that it is deprecated for Yosemite.
[CWInterface interface]
As usual, there are no recommendations on this topic in the Apple documentation.
So, how can I get the current Wifi network name in Yosemite with Swift?
So, I figured it out. If you pass nilin interfaceName, it will provide you with the currently connected Wi-Fi network. Then you can call ssid()to get the network name.
nil
interfaceName
ssid()
Same: CWInterface(interfaceName: nil).ssid()
CWInterface(interfaceName: nil).ssid()
Xcode 10.2 • Swift 5 OSX Mojave
import CoreWLAN var ssidName: String { return CWWiFiClient.shared().interface(withName: nil)?.ssid() ?? "" }