This is the workflow of my app: User can select a default printer from app's settings page and will use this default printer to print every time directly without any print preview dialogue.
We can select a printer using UIPrinterPickerController
:
let printerPicker = UIPrinterPickerController(initiallySelectedPrinter: nil)
printerPicker.present(from: CGRect(x: 0, y: 0, width: 600, height: 500), in: self, animated: true) { (printerPicker, userDidSelect, error) in
if userDidSelect {
//Here get the selected UIPrinter
let defaultPrinter = printerPicker.selectedPrinter
}
}
After getting the UIPrinter
, we can't directly save the UIPrinter
object to UserDefaults, which is not a UserDefault support type.
Is there any other options to save UIPrinter
to UserDefaults or any other way to save a default printer.