Hi there,
My task sounds simple: the goal is to call from the "draw" method of a custom class which extend an NSView another method who do calculation and then draws something in the view.
override init(frame frameRect: NSRect) {
// .. some code here
self.drawMethod(rect: rect)
//
}
here is the method used to draw my stuff:
@objc func drawMethod(rect : CGRect) {
let width = Double(rect.size.width)
let height = Double(rect.size.height)
// ... some code here
for x in stride(from: 0, to: width, by: blockiness) {
for y in stride(from: 0, to: height, by: blockiness) {
//
}
}
self.setNeedsDisplay(rect)
}
So far so good: the problem is that the content of the view is displayed after some secods while I would like to display an update each end of the inner for cicle.
Coming from the .NET world, I would do just an "
Application.DoEvents()"
How can I achieve here the same result?
Forgot ... I'm using (learning) Swift 5 and the target is macOS current version :-)