irosenb irosenb - 4 years ago 372
Swift Question

How do I get the current wifi network name after Yosemite in Swift?

In Mavericks I was using

[CWInterface interface]
to grab the currently connected network. That has been deprecated for Yosemite.

As usual Apple documentation provides no guidance on this topic.

So how can I get the currently connected Wifi network name in Yosemite with Swift?

Answer Source

So I figured it out. If you pass nil to the interfaceName, it will give you the currently connected wifi network. You can then call ssid() to get the name of the network.

Like so: CWInterface(interfaceName: nil).ssid()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download