SwiftUI - Horizontal Scroll not Working with NSTextView in NSViewRepresentable

Hello,

I have an NSViewRepresentable displaying an NSTextView in SwiftUI.

GeometryReader() { geometry in
    ScrollView([.vertical, .horizontal]) {
        Representable()
        // -18 for vertical scroller
        .frame(minWidth: geometry.size.width - 18)
    }
}

When I use the vertical scrollbar the mouse click is passed to the Representable and is not registered by the Scroll bar. In the image you can see I tried to use the scroll bar and it highlighted some text instead.

There is a suggestion on stackoverflow to use an overlay. This fixes the scrolling issue, but will then make the Representable uninteractable.

How can I use the horizontal scroll bar here as expected?

To anyone looking for an answer to this, the best solution I can determine is to make my own scroll view. I need to do this for a variety of reasons.

I detailed here how I'm doing it. https://stackoverflow.com/questions/79132260/scroll-multiple-views-with-one-scrollview

SwiftUI - Horizontal Scroll not Working with NSTextView in NSViewRepresentable
 
 
Q