Open lucaswitch opened 5 days ago
These examples are quite outdated(React Native 0.71) We have better examples in the new documentation: ios, with events
We will add more guides in the future. For the swift support, is should not be much different though: you still need a wrapper in objective-C++ that extends the module and the wrapper needs to be composed with the swift implementation. You can pass to swift a delegate with the wrapper and call the emit
from there. RCTEventEmitter
is the old architecture way to emit events, now that we have type-safe event emitters generated by codegen.
These examples are quite outdated(React Native 0.71) We have better examples in the new documentation: ios, with events
We will add more guides in the future. For the swift support, is should not be much different though: you still need a wrapper in objective-C++ that extends the module and the wrapper needs to be composed with the swift implementation. You can pass to swift a delegate with the wrapper and call the
emit
from there.RCTEventEmitter
is the old architecture way to emit events, now that we have type-safe event emitters generated by codegen.
Thank you for the amazing work!
I guess many libraries prefer to use swift over objective c++. We're not quite sure how to use objective c++ swift wrapper on new arch. Can you provide an example with that configuration?
On bridge docs we're adding that feature like this:
Objective C
@interface RCT_EXTERN_MODULE(SomeAwesomeLibraryInObjC, NSObject)
// the methods
@end
Swift
@objc(SomeAwesomeLibraryInObjC)
class SomeAwesomeLibrary
But i'm sure that will not work on new arch.
https://github.com/react-native-community/RNNewArchitectureLibraries/tree/feat/swift-event-emitter When trying to implement the new event emitter pattern. Can we still rely on RCTEventEmitter on new arch or that is something that will be removed?