Skip to content

Instantly share code, notes, and snippets.

@EricADockery
Created February 10, 2018 15:42
Show Gist options
  • Save EricADockery/9ef1da7ad60c98550be40fb4020b8130 to your computer and use it in GitHub Desktop.
Save EricADockery/9ef1da7ad60c98550be40fb4020b8130 to your computer and use it in GitHub Desktop.
func findConnectedPrinter(completion: (Bool) -> Void) {
let connectedDevices = manager.connectedAccessories
for device in connectedDevices {
if device.protocolStrings.contains(“com.zebra.rawport”) {
serialNumber = device.serialNumber
connectToPrinter(completion: { completed in
completion(completed)
})
}
}
}
private func connectToPrinter( completion: (Bool) -> Void) {
printerConnection = MfiBtPrinterConnection(serialNumber: serialNumber)
printerConnection?.open()
completion(true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment