[英]How to bridge Swift View in ObjectC for React Native
I'am new in this Objc and Swift.我是这个 Objc 和 Swift 的新手。 I need some small example.我需要一些小例子。 I dont know what search.我不知道什么搜索。
Objective C very complicated for me.目标 C 对我来说非常复杂。
Can anyone give any simple example, how in Objective C import Swift View as react-native module?谁能举个简单的例子,如何在Objective C import Swift View as react-native模块中查看?
//this is swift file
import SwiftUI
struct SwiftUIView: View {
var body: some View {
Text("Hello, World!")
}
}
//i need use RCTView and RCTViewManager somehow in ObjectiveC files
Please give some example how import SwiftUIView or any other View from Swift to ObjectC and add export as RCTView请举例说明如何将 SwiftUIView 或任何其他视图从 Swift 导入到 ObjectC 并将导出添加为 RCTView
here's a tutorial how to bridge a native iOS component to react-native https://youtu.be/q5M07Q1JFZw but it's for Alert, if you need to create like a completely custom UI element you will probably need to actually learn swift. here's a tutorial how to bridge a native iOS component to react-native https://youtu.be/q5M07Q1JFZw but it's for Alert, if you need to create like a completely custom UI element you will probably need to actually learn swift. It would be easier to help you, if you would describe what are you actually trying to accomplish.如果你能描述你真正想要完成的事情,那么帮助你会更容易。 Because there are rare scenarios when you actually need to program native UI in a native code.因为在极少数情况下,您实际上需要在本机代码中编写本机 UI。
There's also documentation on importing native modules to react-native https://reactnative.dev/docs/native-modules-intro maybe that can help you.还有关于将本机模块导入 react-native https://reactnative.dev/docs/native-modules-intro的文档可能对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.