迷失在 Ionic、Cordova 等混合应用程序框架中,
Lost in hybrid app frameworks like Ionic, Cordova,
我目前对所有这些混合移动应用程序框架感到困惑。它们听起来都很棒,但我找不到任何关于用例和主要区别的真实信息。
有人可以向我解释它们或为我提供大量资源,尤其是关于用例的资源吗?
我知道这些:Apache Cordova、Ionic、PhoneGap、Steroids (AppGyver)、Supersonic (AppGyver)、React Native 和新的 Microsoft Ace (http://microsoft.github.io/ace/)。
免责声明:有可能我把它们完全混在一起,它们之间没有任何关系,因为我迷路了。
我已经研究这个主题至少几年了,一直想写一篇深思熟虑的博客 post 总结我所学的内容,但它似乎从未达到顶峰我的优先列表。我将在这里提供一个简短的摘要。
混合应用的三个类
- 通过 Webview 混合
- 通过交叉编译的混合
- 通过JavaScript核心
混合
NOTE: I'm sure there's are better names for the above, but this is the
best I'm coming up with at the moment.
通过 Webview 混合
通常,这些是您上面提到的基于 cordova(又名 phone 差距)的应用程序,例如 Ionic, TouchstoneJS, Meteor, and AppGyver Steroids. In fact, Steroids is built on top of Ionic if I remember correctly. These apps attempt to solve the hybrid problem by mimicking native-like components (buttons, list views, drawer layouts, tab views, etc) using standard web-based technologies (html, css, javascript). To access the devices native components, they use a bridge called cordova, which exposes a javascript api to native components such as camera, gps, location, vibration, etc. This is a robust community and if you need access to a native component, you're likely to find a cordova plugin that will meet your needs. The challenge for these types of apps is and has always been performance. Because they render the entire app in a WebView(基本上是没有 chrome 的全屏浏览器 window) ,它只有一个线程来渲染整个页面并执行任何动画等。最后,因为组件很接近,但不太像原生组件,而且因为性能很接近,但不像原生性能那么流畅,这些应用程序往往落在恐怖谷的某个地方。它们看起来和感觉起来都不错,但它们从来都不是。
通过交叉编译的混合
例如 Appcelerator's Titanium and Xamarin。这些应用程序通过将本机 API 抽象为通用语言来解决混合问题。对于 Titanium,该语言是 JavaScript。对于 Xamarin,该语言是 C#。因此,要在 Xamarin 中编写 Android、iOS、Windows 和桌面应用程序,您需要使用它们的抽象 (API) 在 C# 中编写所有代码,然后将它们交叉编译为实际的本机应用。这些方法的想法是正确的,但许多人会说,在实际实施时它们存在不足。尽管我有使用 Titanium 的个人经验,但我发现实际上构建应用程序非常痛苦,因为你依赖于它们的抽象。如果他们的抽象层中存在错误,你就会陷入困境......直到他们修复它。
通过JavaScript核心
混合
据我所知只有两个这样的例子,Facebook's React Native and Telerik's NativeScript. This is the future of mobile application development in my opinion, and if I were you, this is where I'd focus my energy. Both of these attempt to solve the hybrid problem similarly in that in each case the developer ultimately writes JavaScript to create native components, but each takes a very different approach. React Native translates your JavaScript to Native through the RCTBridgeModule, whereas Native Script gives you direct access to native apis through some clever trickery in the JavaScript Virtual Machines。我还没有使用过 NativeScript,所以不知道它有多成熟或性能如何。我安装了他们的示例应用程序,但感觉有点迟钝。我认为它最酷的价值主张之一是它确实让您 100% 访问本机 API(令人兴奋!)。在过去的一年里,我广泛地使用了 React Native,给我留下了深刻的印象。两人都还很年轻,一定会成熟的。
有用的资源
我对像 react-native 这样的混合框架的个人经验是,老实说,它们很棒,但是......
- 与原生相比,用户体验非常接近但不相等
- 原生平台更新和功能将等待框架更新
- 如果你需要延长,在大多数情况下可能会很痛苦
在我的公司,我们创建了一个框架,允许开发共享业务逻辑的混合应用程序,使用通量模式实现。
然而,UI 完全是原生的。
有关详细信息,请访问 https://github.com/bfortunato/aj-framework
它是完全开源的。
我目前对所有这些混合移动应用程序框架感到困惑。它们听起来都很棒,但我找不到任何关于用例和主要区别的真实信息。
有人可以向我解释它们或为我提供大量资源,尤其是关于用例的资源吗?
我知道这些:Apache Cordova、Ionic、PhoneGap、Steroids (AppGyver)、Supersonic (AppGyver)、React Native 和新的 Microsoft Ace (http://microsoft.github.io/ace/)。
免责声明:有可能我把它们完全混在一起,它们之间没有任何关系,因为我迷路了。
我已经研究这个主题至少几年了,一直想写一篇深思熟虑的博客 post 总结我所学的内容,但它似乎从未达到顶峰我的优先列表。我将在这里提供一个简短的摘要。
混合应用的三个类
- 通过 Webview 混合
- 通过交叉编译的混合
- 通过JavaScript核心 混合
NOTE: I'm sure there's are better names for the above, but this is the best I'm coming up with at the moment.
通过 Webview 混合
通常,这些是您上面提到的基于 cordova(又名 phone 差距)的应用程序,例如 Ionic, TouchstoneJS, Meteor, and AppGyver Steroids. In fact, Steroids is built on top of Ionic if I remember correctly. These apps attempt to solve the hybrid problem by mimicking native-like components (buttons, list views, drawer layouts, tab views, etc) using standard web-based technologies (html, css, javascript). To access the devices native components, they use a bridge called cordova, which exposes a javascript api to native components such as camera, gps, location, vibration, etc. This is a robust community and if you need access to a native component, you're likely to find a cordova plugin that will meet your needs. The challenge for these types of apps is and has always been performance. Because they render the entire app in a WebView(基本上是没有 chrome 的全屏浏览器 window) ,它只有一个线程来渲染整个页面并执行任何动画等。最后,因为组件很接近,但不太像原生组件,而且因为性能很接近,但不像原生性能那么流畅,这些应用程序往往落在恐怖谷的某个地方。它们看起来和感觉起来都不错,但它们从来都不是。
通过交叉编译的混合
例如 Appcelerator's Titanium and Xamarin。这些应用程序通过将本机 API 抽象为通用语言来解决混合问题。对于 Titanium,该语言是 JavaScript。对于 Xamarin,该语言是 C#。因此,要在 Xamarin 中编写 Android、iOS、Windows 和桌面应用程序,您需要使用它们的抽象 (API) 在 C# 中编写所有代码,然后将它们交叉编译为实际的本机应用。这些方法的想法是正确的,但许多人会说,在实际实施时它们存在不足。尽管我有使用 Titanium 的个人经验,但我发现实际上构建应用程序非常痛苦,因为你依赖于它们的抽象。如果他们的抽象层中存在错误,你就会陷入困境......直到他们修复它。
通过JavaScript核心
混合据我所知只有两个这样的例子,Facebook's React Native and Telerik's NativeScript. This is the future of mobile application development in my opinion, and if I were you, this is where I'd focus my energy. Both of these attempt to solve the hybrid problem similarly in that in each case the developer ultimately writes JavaScript to create native components, but each takes a very different approach. React Native translates your JavaScript to Native through the RCTBridgeModule, whereas Native Script gives you direct access to native apis through some clever trickery in the JavaScript Virtual Machines。我还没有使用过 NativeScript,所以不知道它有多成熟或性能如何。我安装了他们的示例应用程序,但感觉有点迟钝。我认为它最酷的价值主张之一是它确实让您 100% 访问本机 API(令人兴奋!)。在过去的一年里,我广泛地使用了 React Native,给我留下了深刻的印象。两人都还很年轻,一定会成熟的。
有用的资源
我对像 react-native 这样的混合框架的个人经验是,老实说,它们很棒,但是......
- 与原生相比,用户体验非常接近但不相等
- 原生平台更新和功能将等待框架更新
- 如果你需要延长,在大多数情况下可能会很痛苦
在我的公司,我们创建了一个框架,允许开发共享业务逻辑的混合应用程序,使用通量模式实现。 然而,UI 完全是原生的。
有关详细信息,请访问 https://github.com/bfortunato/aj-framework 它是完全开源的。