Here is the solution I found. When using NSHostingView to wrap a SwiftUI View to use with AppKit, don't set the SwiftUI View x and y position parameters within the SwiftUI View itself. If you do, the NSHostingView will visually render properly but the NSEvent handling area for the NSHostingView will be offset and it won't respond to mouse events (it did work fine back in macOS 14). Only set the width and height parameters in the SwiftUI View and then when you have the resulting NSHostingView of that, you can set the NSHostingView frame parameter to properly place it on an NSWindow. Presumably this is an API bug. NSHostingView is supposed to do the correct coordinate transform on the SwiftUI View to make it into a usable NSHostingView but this is no longer the case with macOS 15. Use this solution if you have the same error because it took me days to find this solution.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: