Skip to content

Instantly share code, notes, and snippets.

@EricADockery
Created February 10, 2018 15:42
Show Gist options
  • Save EricADockery/c5fb87b90a7d032b167eb9d9751a9ddb to your computer and use it in GitHub Desktop.
Save EricADockery/c5fb87b90a7d032b167eb9d9751a9ddb to your computer and use it in GitHub Desktop.
class ViewController: UIViewController {
@IBOutlet var printerConnectionStatus: UILabel!
var printManager = PrintManager.sharedInstance
override func viewDidLoad() {
super.viewDidLoad()
printManager.connectionDelegate = self
if printManager.isConnected {
printerConnectionStatus.text = “Connected”
} else {
printerConnectionStatus.text = “Not Connected”
}
}
@IBAction func printTestLabel(_ sender: Any) {
printManager.printBarcode(for: “This is a test”)
}
}
extension ViewController: EAAccessoryManagerConnectionStatusDelegate {
func changeLabelStatus() {
if printManager.isConnected {
printerConnectionStatus.text = “Connected”
} else {
printerConnectionStatus.text = “Not Connected”
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment