I'm trying to draw to a NSView
from a background operation, but don't see any effect.
let queue = OperationQueue()
queue.addOperation() {
doTheBackgroundStuff()
}
starts the background operation, which is doing lots of calculations. In the AppDelegate I have
@IBOutlet weak var image: NSImageView! // some image to show
@IBOutlet weak var number: NSTextField! // a corresponding number
@IBOutlet weak var mainView: NSView! // the main view holding the above
The assignment
number.intValue = Int32(someNumber)
is issued from the background operation regularly (often). But the text does never change. I have set the "can draw concurrently" in IB for the view as well as for the TextField. I also tried
if mainView.lockFocusIfCanDraw() {
mainView.setNeedsDisplay(mainView.rectPreservedDuringLiveResize)
mainView.unlockFocus()
}
after the text field assignment. Also to no avail.