List of Available AirPrint Printers

I would like to show a list with all the printer accessible through the device through AirPrint.

I am working using UIPrinterPickerController .

Be that as it may, displaying this PickerController in a user-friendly way, let's say feed data into a UITableView ?

Also note that I plan to use this app on an iPad that only supports UIPrinterPickerController.presentFromRect(CGRect)

Here's what it looks like right now. Instead, this popup should have a UITableView

Printer popup

+6
source share
1 answer

NSNetServiceBrowser exactly for this.

In short, you need to do the following:

1) set the object as NSNetServiceBrowserDelegate 2) create the NSNetServiceBrowser object 3) assign a delegate 4) using browserObject.searchForServices(ofType: "_printer._tcp.", inDomain: "") , will receive various feedback from the delegate.

A simple test at my end got:

 didFind: Samsung C460 Series (SEC001174EDCB63) 

for delegate method:

 func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { print("didFind: \(service.name)") } 
+2
source

All Articles