Commit Graph

5 Commits

Author SHA1 Message Date
Juan Pablo Civile 28c689b77b bind: annotate all remaining ObjC types for nullability
From Xcode 10.2 onwards, these annotations are required in all interface
declarations. The behaviour can be disabled, but since we were already
annotated most types it made sense to just annotate the rest.

Change-Id: Iacd09a2fea4dfb3e22fec97cf4ca22966fc783bf
GitHub-Last-Rev: a431572a83ea8b29f55813bcdafc9a00f8d15972
GitHub-Pull-Request: golang/mobile#29
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/171957
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-04-12 20:20:09 +00:00
Juan Pablo Civile b826ec11c3 bind: annotate ObjC types with nullability annotations
This highly improves interop with Swift. It would map all
pointers as implicitly unwrapped optionals, which skip all
null safety checks. Adding `_Nullable` to pointer types
makes swift map them as optionals.

Also constructors are now nullable since it's valid to return nil from
Go code.

Change-Id: If0506bb80f31bf36f11522c16a1e66d77be935f8
GitHub-Last-Rev: bd6c30f7f50ef5ea5797b07073f0a4a70d545025
GitHub-Pull-Request: golang/mobile#26
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/159477
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-03-05 23:50:31 +00:00
Steeve Morin a421117049 bind: always include ref.h in generated ObjC headers
Current generated headers work because they require `ref.h` to be loaded beforehand by the bridging header. However, in some cases where the bridging header is generated by another tool (such as Bazel), the order can't be guaranteed.

Fix that by explicitly importing `ref.h` in the headers that need it.

Change-Id: I444453a0ebdf53e14ba1b5290f7cc7084eaf2c07
GitHub-Last-Rev: e1e1e915bf0428d871cb1a268c8456cf7051d383
GitHub-Pull-Request: golang/mobile#28
Reviewed-on: https://go-review.googlesource.com/c/159758
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-01-27 14:38:45 +00:00
Juan Pablo Civile 9f4912738d bind: use property syntax for ObjC
The current header generation uses old style Objective C
getters/setters. This causes Swift to incorrectly bridge properties as
methods. Using @property lets you write goObj.str = "value" (vs
goObj.setStr("value")).

Change-Id: I99d63743623734414edd50343dbdded52bdf2bf5
GitHub-Last-Rev: fb0ad7ec50d25ae5aa75ed729b04b95b99672f04
GitHub-Pull-Request: golang/mobile#27
Reviewed-on: https://go-review.googlesource.com/c/159618
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-01-25 17:33:52 +00:00
Elias Naur 8ee74ac900 bind: support underscores in identifiers
Fixes golang/go#18536

Change-Id: I82c5993547e4d1d0df14726ccc569e1f57128072
Reviewed-on: https://go-review.googlesource.com/101156
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-21 16:27:11 +00:00