title: How to scan nearby Wifi devices in swift?
body: <p>I want to implement code for scan the nearby wifi devices.
  I am not getting proper solution for this after doing lots of research.
  Can you please give me proper solution to scan the nearby wifi devices?
  I have implemented below code. It only getting information of wifi which is already connected.
  Below is the code:</p>
  <pre><code>func getInterfaces() -&gt; Bool {
      guard let unwrappedCFArrayInterfaces = CNCopySupportedInterfaces() else {
          print(&quot;this must be a simulator, no interfaces found&quot;)
          return false
      }
      guard let swiftInterfaces = (unwrappedCFArrayInterfaces as NSArray) as? [String] else {
          print(&quot;System error: did not come back as array of Strings&quot;)
          return false
      }
      for interface in swiftInterfaces {
          print(&quot;Looking up SSID info for \(interface)&quot;) // en0
          guard let unwrappedCFDictionaryForInterface = CNCopyCurrentNetworkInfo(interface as CFString) else {
              print(&quot;System error: \(interface) has no information&quot;)
              return false
          }
          guard let SSIDDict = (unwrappedCFDictionaryForInterface as NSDictionary) as? [String: AnyObject] else {
              print(&quot;System error: interface information is not a string-keyed dictionary&quot;)
              return false
          }
          print(SSIDDict)
      }
      return true
  }
  </code></pre>
  <p>It return output is below.</p>
  <pre><code>Looking up SSID info for en0
  [&quot;SSIDDATA&quot;: &lt;4575726f 74726f6e 6963&gt;, &quot;BSSID&quot;: d4:3d:37:14:9:2f, &quot;SSID&quot;: Vikas]
  </code></pre>
  <p>Can you please help me to scan the nearby wifi devices functionality?</p>