Closed makadaw closed 2 years ago
It's possible. This rule aren't currently generating a header map for the Swift header, so you will need to add additional flags to objc_copts
, for example:
https://github.com/line/rules_apple_line/blob/9bd940ec3929c405d857cb1afc2cbef7300cad90/examples/ios/Mixed/BUILD#L6-L18 https://github.com/line/rules_apple_line/blob/9bd940ec3929c405d857cb1afc2cbef7300cad90/examples/ios/Mixed/MXDObjcGreeter.m#L16
@thii thanks for the response. I found the problem with header files. I did all declarations in one BUILD file (did it for a fast prototype) and Bazel didn't create subfolders in BINDIR
.
Still didn't find how internal @objc
properties work in the frameworks. Xcode can access them in ObjC code, but Bazel can't.
If you have a package at path/to/MyModule
, then the flag is -I$(BINDIR)/path/to
. If you put everything in a top-level BUILD
file, then you can only import the header by #import "MyModule-Swift.h"
.
Hi folks, I have looked into Bazel for a project with mixed modules and found one difference. According to Apple docs https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_swift_into_objective-c
Swift declarations of
@objc
properties and methods withinternal
access level should be available in ObjC files of the same module. And Xcode working according to the doc. My module declaration is fairly simple:Also, I can access generated Swift header only via
#import "MyModule-Swift.h"
and can't with#import <MyModule/MyModule-Swift.h>"
Is this Xcode internal feature or I'm doing something wrong?