Trying to setup printing from a custom NSTextView (which uses TextKit components). This is what I now do using a second view:
override func printView(_ sender: Any?) {
let printTextView = MyTextView(frame: view.frame, textContainer: self.textContainer)
let op = NSPrintOperation(view: printTextView)
op.run()
}
So when the Print Dialog appears, it shows the correct text with attributes and layout, but the original MyTextView
is suddenly empty, as if the text was moved from the view to the print view.
What am I missing here?