NSHostingView in a NSViewRepresentable

Hello

What is the correct way to use a NSHostingView in a NSViewRepresentable?

Basically I want to create a wrapper around my custom NSScrollView. I cannot use SwiftUI's scrollview due to specific functionality in my custom NSScrollView.

I have minimal working code that renders the NSScrollView and its NSHostingView contents correctly. But state changes stopped working for the content ...

I would love to see an example where NSScrollView is wrapped and the content is again a SwiftUI view. (with state changes)

Thanks & Cheers!

Gerd

NSHostingView in a NSViewRepresentable
 
 
Q