How to use view created in swift inside an objective-c++ file? #57
Replies: 3 comments
-
|
Disclaimer: I'm not a Swift expert. I believe what you're trying to achieve is not possible. In order to use Swift, you'll have to enable |
Beta Was this translation helpful? Give feedback.
-
|
Hey @cortinico Check this repo I have used |
Beta Was this translation helpful? Give feedback.
-
|
@cortinico Also check this |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use
react-native's new architectureand I have enabledfabricfor the same. I am able to use a view created inobjective-c++inside mytypescriptcode. But I want to use a view created inswiftwithUIKitin myobjective-c++fileThe documentation on react-native's website is still for the old architecture of using bridge so it does not directly apply in my case. There are pretty significant changes in the new architecture.
Below is the working code for objective-c++ file
Now to use a
viewwhich is created inswiftinside myobjective-c++file, I use the following approachCreated a swift file called
RNThubView. Following is the code for the sameAnd I updated my
objective-c++file code to the followingRest of the code remains mostly the same in
objective-c++file.Now when I run via cli, the app crashes with no logs on cli. When I run via
Xcode, I get following logs with a white screen on the simulatorFull source is here https://github.com/PritishSawant/ReactNativeFabricSwiftTry
Also how to pass
propsfromobjective-c++toswift. In my example it is acolorprop which once set from react-native's side should use the value in myswiftfile.Beta Was this translation helpful? Give feedback.
All reactions