Hey StackOVerflow community!
I'm building some macOS app that should "read" and highlight some specific words on the screen. Only if they are inside NSTextView or NSTextField.
While using Accessibility API I can get the text out of these UI elements as well as I can add a transparent NSWindow on top of the target app where I can then draw highlighting. The problem is that I don't know how to find coordinates of some specific words so that I can draw my highlighting.
To give you some real-world example here is the screenshot of the Grammarly app. Whenever it finds a typo - it places NSWindow on top of the text area where they draw bubbles. I'm building a very similar app.
On the picture, I provided you can see that "Hello" as well as "wold" is highlighted. "Hello" also has a Hover view that gets visible whenever the mouse is on top of this word. So to my understanding, they are using some Accessibility API to get coordinates. The question is which API?
Thanks in advance for any support!