Toolkit/API for Interacting with Active Editable Text Boxes on macO

I am developing an application that needs to interact with active editable text boxes on macOS, similar to how Grammarly functions. Specifically, my application needs to:

Read and write text in the currently active editable text box where the keyboard input is directed. Move the writer cursor and mark text within the text box. Ideally, the solution should support cross-platform functionality, covering both macOS and Windows. Does anyone know of any toolkits, libraries, or APIs that can facilitate this kind of functionality on macOS?

chould i use the accessibility API?

Toolkit/API for Interacting with Active Editable Text Boxes on macO
 
 
Q