Draw in a NSView using async/await

104 views Asked by At

Requesting guidance to use threading in drawing lines and circles on an NSView using threads. Below is the code structure I am using and getting the context error.

override func draw(_ dirtyRect: NSRect) {

    Task {
        await plotYAxis()
    }

}

func plotYAxis() async {
    //Code to draw lines and labels
    ...
    ...
}

Below is the error --

**CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

...

...

...

...**

0

There are 0 answers