[英]How to use an existing swift app in react native?
There are some things that CAN be done in react native but due to performance concerns, I have decided to implement in Swift and then run it in react native, for example, image processing. 可以在react native中做一些事情,但是由于性能方面的考虑,我决定在Swift中实现,然后在react native中运行它,例如图像处理。
Suppose I have a swift app that doesn't do anything other than displaying Hello World
like so: 假设我有一个快速的应用程序,除了像这样显示Hello World
之外,它什么也不做:
the code for it is not modified at all: 完全不修改其代码:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
I would like to run this simple app in react native in this fashion: 我想以这种方式运行本机以响应本机:
SimpleApp.show();
How can I make this happen? 我怎样才能做到这一点?
You could do so using NativeModules 您可以使用NativeModules这样做
Interesting helpful article that helped me through my fitness application: Swift Modules for React Native 有趣的实用文章对我的健身应用程序有所帮助: React Native的Swift模块
And this one would help too! 而这一点也有帮助! React Native app in Swift 在Swift中响应本机应用
Happy coding :) 快乐的编码:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.