5

SwiftUI has onHover for View to hook hover events, but it only gives feedback of hovered or not, which is a Bool.

How can I get the mouse location when View is on hover ?

duan
  • 8,515
  • 3
  • 48
  • 70
  • Have you tried `NSEvent.mouseLocation` ? [This answer could also help you](https://stackoverflow.com/questions/31931403/getting-mouse-coordinates-in-swift) – Alladinian Oct 22 '19 at 09:53
  • @Alladinian thanks for responding. I will try use `NSView` in SwiftUI later – duan Oct 23 '19 at 04:50

0 Answers0