Search code examples
cocoagococoa-bindingsscripting-bridge

Cocoa bindings for the Go language


Is it possible to write macOS/Cocoa applications in Google Go?

Is there a Go-Obj-C bridge? (it seems to me that Obj-C dynamism would be a great fit for Golang's interfaces)

Can I at least link the two together and make them talk to each other via plain-old C functions?


Solution

  • You can have a look at my blog post as an example. I'm afraid I didn't keep working on it, but here's the source code that can help you setting up a bare Cocoa/ObjC/Go project.

    You're gonna be able to do something like this, as mentioned in the README.

    package main
    
    import (
      "github.com/alediaferia/gogoa"
    )
    
    func main() {
        app := gogoa.SharedApplication()
        window := gogoa.NewWindow(0, 0, 200, 200)
        window.SetTitle("Gogoga!")
        window.MakeKeyAndOrderFront()
    
        app.Run()
    }