Adding AppleScript to an app used to be quite clunky. There were a bunch of classes encapsulating AppleScript verbs and so on that you had to wire up. About ten years ago, they added some reflection-based things that let you just expose an Objective-C class as a scripting interface. They also did the converse and made it easy to use AppleScript interfaces from Objective-C, which made it easy for one app to drive another without needing to embed AppleScript code as text that Objective-C code would then pass to another parser.
@david_chisnall @beka_valentine I have, admittedly, yet to make an app scriptable myself, so I am not sure how hard it would be, particularly in Python; I should definitely get around to that. I do wonder if this stuff exists in Swift?
I think most of the Objective-C stuff is bridged in Swift, but I’ve never tried using Swift seriously. And SwiftUI is such a huge step backwards that it’s hard to take the ecosystem seriously.