How to check if WiFi is on or off in iOS Swift 2?
<p>I want to check if the wifi is off then show alert to the user to check his/her connectivity.</p>

<p>I find code like this but it checks if there is an internet connection, not checking if the wifi is on or off:</p>

<pre><code>func isConnectionAvailble()-&gt;Bool{

  var rechability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, "www.apple.com").takeRetainedValue()

  var flags : SCNetworkReachabilityFlags = 0

  if SCNetworkReachabilityGetFlags(rechability, &amp;flags) == 0
  {
     return false
  }

  let isReachable = (flags &amp; UInt32(kSCNetworkFlagsReachable)) != 0
  let needsConnection = (flags &amp; UInt32(kSCNetworkFlagsConnectionRequired)) != 0
  return (isReachable &amp;&amp; !needsConnection)
}
</code></pre>