Dear members,

I'm making a private app (just for test purposes) and I am trying to convert the following code into the swift language:

static WiFiManagerRef _manager;
static void scan_callback(WiFiDeviceClientRef device, CFArrayRef results, CFErrorRef error, void *token);

int main(int argc, char **argv)
{
   _manager = WiFiManagerClientCreate(kCFAllocatorDefault, 0);

   CFArrayRef devices = WiFiManagerClientCopyDevices(_manager);
   if (!devices) {
       fprintf(stderr, "Couldn't get WiFi devices. Bailing.\n");
       exit(EXIT_FAILURE);
   }

   WiFiDeviceClientRef client = (WiFiDeviceClientRef)CFArrayGetValueAtIndex(devices, 0);

   WiFiManagerClientScheduleWithRunLoop(_manager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
   WiFiDeviceClientScanAsync(client, (CFDictionaryRef)[NSDictionary dictionary], scan_callback, 0);

   CFRelease(devices);

   CFRunLoopRun();

       return 0;
}

static void scan_callback(WiFiDeviceClientRef device, CFArrayRef results, CFErrorRef error, void *token)
{
   NSLog(@"Finished scanning! networks: %@", results);

   WiFiManagerClientUnscheduleFromRunLoop(_manager);
   CFRelease(_manager);

   CFRunLoopStop(CFRunLoopGetCurrent());
}

But I'm stuck at this part:
WiFiDeviceClientScanAsync(client, (CFDictionaryRef)[NSDictionary dictionary], scan_callback, 0);


I can't figure out how to use the scan_callback in Swift.
I found this example on the internet, but I don't know how to implement it for this function:

pcap_loop(pcapSession, numberOfPackets,
{
   (args: UnsafeMutablePointer<u_char>,
    pkthdr:UnsafePointer<pcap_pkthdr>,
    packet: UnsafePointer<u_char>) ->Void in

           // singleton call
           let pa = PacketAnalyser.sharedInstance
           pa.Process()
},
nil)


Can someone please give me a hand.
Thanks in advance!