I am trying to draw in NSViewfrom a background operation, but I see no effect.
let queue = OperationQueue()
queue.addOperation() {
doTheBackgroundStuff()
}
launches a background mode that does a lot of computing. In AppDelegate I have
@IBOutlet weak var image: NSImageView!
@IBOutlet weak var number: NSTextField!
@IBOutlet weak var mainView: NSView!
Appointment
number.intValue = Int32(someNumber)
regularly issued from a background operation (often). But the text never changes. I set "can draw at the same time" in IB for presentation, as well as for TextField. I also tried
if mainView.lockFocusIfCanDraw() {
mainView.setNeedsDisplay(mainView.rectPreservedDuringLiveResize)
mainView.unlockFocus()
}
after assigning a text field. Also to no avail.
source
share