How to enable a background thread to draw to NSView

Viewed 342

What is the best way to make NSView drawRect: render content that is drawn and updated by a background thread continuously?

  1. Background thread updates backing store & flags view for update
  2. macOS calls drawRect: to render backing store to screen

The background thread is running permanently.

Up until SDK 10.13 it was possible to have the background thread lockFocus / unlockFocus on NSView, which very efficiently populated the view's backing store. Rendering that backing store to screen in drawRect: was a snap.

With SDK 10.14 this no longer works (view remains black).

While it's possible to use a bitmap as a backing store, I'd prefer to avoid dealing with screen resolution and other specifics. I hope there's a more transparent and lean way (layers?)

0 Answers
Related