Since the birth of iPhone, smartphones have been popular all over the world for nearly 20 years. The smartphone operating systems iOS and Android have also become the most popular ones. As the soul behind it, mobile applications have become more and more abundant with the development of technology. From a technical perspective, mobile apps have evolved from the initial single native app model to hybrid development (Hybird App) and web application development (Web App). Why are there such development changes?
Because the original Native App has an obvious pain point, that is, the same function needs to be implemented on different platforms, so there is a very urgent need. Can you only need to write code once to run it on all ends?
Mobile cross-platform logic
Cross-platform development is essentially to increase the reuse rate of business code, reduce the workload caused by adapting to multiple platforms, and thus reduce development costs. While increasing business focus, it can provide users with a consistent user experience and achieve the effect of "faster, better, better, and more efficient".
cross-platforms which platforms does
cross-platforms? What kind of cross-platform logic? Judging from the current actual situation, the cross-platform demand of mobile terminals is mainly concentrated in the following three points:
- Desktop cross-mobile terminal: the early stage of the transition from desktop to mobile terminal, I hope that PC Web and mobile Web will reuse the same set of code.
- Native Cross-Web: A set of web pages with similar functions can be accessed outside the end, and needs to cross Native App and Web.
- cross-system dual-end: for reasons such as development efficiency, it is hoped that Android and iOS will reuse a set of business codes on both ends, which is also the main demand point at present.
Looking to the future, we foresee that there may be these cross-platform needs:
- Cross-mini programs/light applications: lightweight applications that are ready to go, such as mini programs on each platform, Android fast applications, iOS App Clips.
- Cross IoT devices: All kinds of devices with display screens will become new entrances, such as car equipment, smart TVs, etc.
Development of mobile cross-platform solutions
Not only is the continuous evolution of the development model of mobile applications, but the cross-platform development solution is also closely following the changes in the development model. According to the development of technology, cross-platform solutions can be divided into three eras.
1, Web Container Age
Based on web-related technologies, it implements interfaces and functions through browser components. Typical frameworks include Cordova, Ionic and WeChat applets. The solution in the Web era mainly uses native application embedded browser control WebView to render pages, and defines the protocol for interaction between and native code, exposing some native system capabilities to
, thereby extending the boundaries of
. This type of interaction protocol is what we usually call JS Bridge.
Web Container Age
2, Pan Web Container Age
is developed using Web-like standards, but the technology of taking over the drawing and rendering by the native system at runtime is represented by the frameworks including React Native, Weex and fast applications. The transition to the pan-Web container era has optimized the loading, parsing and rendering process of the Web container era, and cropped the Web standard that affects their independent operation. It supports the necessary Web standards (such as Flexbox, etc.) for building mobile pages in a relatively simple way, and also ensures a convenient front-end development experience; at the same time, the solutions of this era basically completely abandon browser control rendering, but use native UI components to replace the core rendering engine, maintaining only the necessary basic control rendering capabilities, thus simplifying the rendering process and ensuring good rendering performance.
Pan Web Container Age
3, Self-drawing engine Age
comes with a rendering engine, and the client only provides one canvas to obtain a highly consistent rendering experience from business logic to functional rendering.Flutter is one of the few representatives. Flutter has opened up a new idea, namely, rewriting a cross-platform UI framework from beginning to end, including rendering logic and even development languages.
self-drawing engine era
comparison of mobile cross-platform technology solutions
Comparison of existing cross-platform technologies and solutions can also be divided into three categories, namely web cross-end, container cross-end, and mini-program cross-end.
1, Web cross-end
Web cross-end is easier to understand because the Web is born with cross-end capabilities. Because as long as there is a browser or WebView, most terminals (even closed mini-program ecosystems) now support Webview, so as long as you develop web pages and then place them on multiple terminals, you can easily cross-platforms, such as Web App, PWA (Progressive Web Apps), Hybrid App, and PHA (Progress Hybrid App).
Advantages:
- has no additional learning costs, a set of basic technology eats the world
- does not rely on special supporting facilities, and all engineering links from development, debugging to operation and maintenance are universal
- backed by npm With a huge ecosystem, millions of modules, all of them are
Disadvantages:
- often encounters white screens, stutters, etc. The user experience is poor
- cannot call the system's permissions, such as multimedia, Bluetooth , cameras, etc.
- has poor performance, and consumes a lot of memory
2, container cross-end
Another unified multi-terminal idea is to customize Native into standard containers, so that the same code runs in standard containers. A typical representative is React Native, Flutter, and Weex. This kind of solution combines the web ecosystem and Native components by learning from each other as much as possible, allowing JS to use Native components to render it after executing code to solve the problem of abandoning the burden of web history.
Specifically, React Native can span Android, iOS, Web, and Windows, Flutter can span Android, iOS, Web, and Linux, and Weex can span Android, iOS, and Web.
Advantages:
- Flutter Rapid development, expressive exquisite UI and native performance
- React Native Focus on the user interface, allowing application developers to build highly reliable interfaces
- Weex pages are like developing ordinary web pages; rendering Weex pages is the same as rendering native pages
Disadvantages:
- React Native There is no application that needs customization. The application files built with native development
- Flutter are large and do not have a broad resource base. This means that the third-party library and packages required for development may not be found. Since it started late, the community activity is not as good as RN, and there is relatively few information and open source projects
3. The mini program cross-end
mini program cross-end is also easy to understand, which is to enable mini programs with the same code to run in multiple apps. For example, after developing a mini program, in addition to letting it run in WeChat , it can also run in super apps such as Alipay , Baidu, and even its own apps.
If the mini program still relies on web technology, why do you still need to use the mini program alone? As mentioned earlier, the Web can never call permissions such as cameras, Bluetooth, etc., and the user experience will have a certain impact. Mini programs are different. Mini programs have a powerful web rendering engine, provide rich components, support local caching, and avoid DOM leakage. Its original intention is to be open. Super Apps such as WeChat and Alipay have also opened up the ability to list mini programs one after another, and mini programs have gradually become a formal way to cross apps.
In the later stage, mini program containers such as FinClip even appeared, which allow individuals or enterprises to have the ability to run mini programs, allowing other apps to have super consistent mini program cross-end capabilities.
Advantages:
- has similar Native App Experience, smooth and silky
- can obtain user's album, multimedia, Bluetooth and other basic permissions
- can complete hot updates of related pages and businesses through convenient upload and removal methods
Disadvantages:
- major platforms are not unified in the framework standards, which will have a slight impact, but they are all similar. W3C is also doing the standardization of mini programs
- part plug-ins will use native related technologies