Thursday, February 11, 2021

Native Mac APIs for Go

MacDriver (via Hacker News):

MacDriver is a toolkit for working with Apple/Mac APIs and frameworks in Go. It currently has 3 “layers”:

[…]

The objc package wraps the Objective-C runtime to dynamically interact with Objective-C objects and classes[…]

[…]

The cocoa, webkit, and core packages wrap objc with wrapper types for parts of the Apple/Mac APIs. They’re being added to as needed by hand until we can automate this process with schema data. These packages effectively let you use Apple APIs as if they were native Go libraries, letting you write Mac applications (potentially also iOS, watchOS, etc) as Go applications[…]

[…]

The bridge package takes advantage of this situation to create a higher-level abstraction more aligned with a potential cross-platform toolkit.

2 Comments RSS · Twitter


There's precedent for this kind of thing like the excellent PyObjC runtime for Python.


Go go go, Go!

It's axiomatic that I find programming anything higher up the stack than POSIX in macOS harder than I ever found dealing with Win32. No, I don't really understand it either, but I'd suggest that the fierce in-breeding between Apple languages/tools/compilers/frameworks/runtimes is a big part of the problem. Other platforms aren't anything like as hostile to the unblessed. And anyway, I'm a C man.

Leave a Comment