title: Trying to figure out CompletionHandler in Swift?
body: <p>So I'm trying to do some programming with Phillips HUE lights and I've already made a bridging header and imported the necessary info to use the Hue SDK with Swift, but all of the guidance is written for Objective-C. I'm having trouble understanding/declaring this function in Swift:</p>
  
  <pre><code>// Start search for bridges
  [self.bridgeSearch startSearchWithCompletionHandler:^(NSDictionary *bridgesFound) {
  
      // Search is complete, handle results (dictionary contains IP and mac addresses of bridges found)
  
      [self showBridgesFound:bridgesFound];
  }
  </code></pre>
  
  <p>When I go to call this in Swift, I type bridgeSearch.startSearch() and Xcode automatically adds this with a Completion handler</p>
  
  <pre><code>//Search for bridges
  let bridgeSearch: PHBridgeSearching = PHBridgeSearching()        
  bridgeSearch.startSearch { ([AnyHashable : Any]?) in
          //code
  }
  </code></pre>
  
  <p>I know how to get the information (found IP addresses) stored into an NSDictionary in Obj-C, but I'm not sure what to do here in terms of storing the IP addresses into some sort of data structure.</p>
  
  <p>Thanks!</p>