Skip to content

Commit

Permalink
generate cgo Objective-C bindings (#56)
Browse files Browse the repository at this point in the history
* generate cgo Objective-C bindings

Generates cgo code and Go wrappers to call the Objective-C methods. Type information in `api` is generated using `macschema` to fetch and parse from the docs.

`go run ./gen/cmd` generates the `*_objc.gen.go` files containing the cgo code to invoke each Objective-C method, and Go wrappers on top of it.

The generated types are meant to be embedded by the author in a struct to include the generated methods, but allow the author to augment them with additional methods, like:
```
type NSFoo struct { gen_NSFoo }
```

* bump Go test targets to 1.16+

The generator uses `embed.FS` to include the template file, which is new
in Go 1.16.

* filter out "NSView.safeAreaRect" due to build error on GitHub

* also filter "WKWebView.pageZoom" that requires mac 11+

Co-authored-by: Matt Good <mgood@users.noreply.github.com>
  • Loading branch information
mgood and mgood authored Oct 8, 2021
1 parent 5a0f96a commit a9ab20f
Show file tree
Hide file tree
Showing 107 changed files with 74,124 additions and 450 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
api/**/*.json linguist-generated
generated/**/*.gen.go linguist-generated
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.16.x, 1.15.x]
go-version: [1.17.x, 1.16.x]
os: [macos-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -15,4 +15,4 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: go test -v ./...
run: go test -v ./...
Loading

0 comments on commit a9ab20f

Please sign in to comment.