Search code examples
gogomobile

golang mobile access file system


How can i access the device system in gomobile?

Is there a way to interact with the native libs?

Like this:

package xy

import(
  "Foundation"// ios libraray
)

// Do some stuff with the Foundation package
func Test(){

}

Solution

  • Yes. Take a look at Reverse Bindings here; https://godoc.org/golang.org/x/mobile/cmd/gobind

    To summarise, you import the Android/ObjectiveC library and are good to go.

    The example they give;

    import "ObjC/Foundation/NSDate d := NSDate.Date()