Cross-Platform Mobile Frameworks — An iOS Engineer's Perspective
This article was mainly written by Rad Azzouz. Akshat Patel took over wrapping up the writing after Rad left on his new adventure.
In the summer of 2017, I joined PSPDFKit as an iOS and support engineer. In my day-to-day work, I was helping our customers integrate PSPDFKit for iOS into their projects and customize its behavior. To be able to offer first-level support for other platforms — like Android, Electron, and web — I began learning more about how they work as well.
We also offered cross-platform mobile frameworks for React Native, Cordova, Ionic, Xamarin.Android, and Xamarin.iOS, so I had to figure out how those frameworks work to help our customers who contacted us for support.
At that time, I wasn’t very fond of hybrid mobile technologies. But this has changed, and in this post, I’ll share a bit about why.
More specifically, I’ll talk about my experience working with cross-platform mobile frameworks from the perspective of an iOS engineer. I’ll also discuss why I think hybrid technologies like Flutter, React Native, Cordova, Ionic, and Xamarin can be powerful tools for mobile development.
What Are Cross-Platform Frameworks?
There are many popular mobile cross-platform frameworks out there! These frameworks enable you to create mobile applications with a single codebase using a popular programming language. Cross-platform frameworks allow software engineers without previous experience with native programming languages like Objective-C, Swift, Java, or Kotlin to develop and deploy applications for iOS and Android.
In the following sections, I’ll cover the most notable mobile frameworks, and I recommend you refer to our Supporting Hybrid Technologies blog post that I wrote a while back for more information. In that post, I classified the cross-platform frameworks by the programming language and the underlying technology they use.
Web-Based Frameworks
React Native, Ionic, and Cordova are often the go-to technologies for web teams that need to write a mobile app. These frameworks rely on technologies like JavaScript, HTML, and CSS, and they’re solutions for companies with an existing web team that don’t have a dedicated mobile team.
Other Popular Programming Languages
Not all cross-platform mobile frameworks are web based. For example, Xamarin is backed by Microsoft, which makes it very easy for C# and .NET developers to start making web applications.
And then there’s Flutter, one of the newest cross-platform frameworks. Flutter is powered by Google and uses Dart as a programming language. Despite Dart and Flutter being relatively new technologies, they’re becoming quite popular — especially among aspiring software engineers. I especially noticed this trend during a recent hiring initiative. Flutter adoption is also growing steadily among our partners’ and customers’ projects.
The Growth of Cross-Platform Frameworks
Over the years, we improved our cross-platform frameworks offerings: We added support for new mobile technologies like Flutter, we rewrote our Cordova and Ionic SDKs, and we added many features to our React Native and Xamarin SDKs.
We did this because, despite the emergence of new native mobile solutions like SwiftUI and Jetpack Compose, the interest in and demand for cross-platform frameworks has increased among our customers and partners. So we, as a company, decided to double down on our efforts and create a dedicated mobile cross-platform frameworks team.
While working on our cross-platform frameworks offerings as an iOS developer, I learned a lot about all cross-platform mobile technologies and their caveats, strengths, and weaknesses. One thing to note is that since I’ve been primarily working on creating and maintaining a cross-platform SDK, my experiences and opinions might not necessarily match those of someone who uses cross-platform technologies mainly to create apps.
The Case for and against Cross-Platform Mobile Frameworks
As an iOS developer, I still think I’d be most productive when using Swift, Objective-C, and Xcode. But I’m also aware that apps can be written very quickly using cross-platform technologies like React Native and Flutter. For example, I’m certain my next side project will use SwiftUI. However, if I had to create any commercial project for a client who needs a mobile app deployed on both Android and iOS, I’d use either Flutter or React Native. That’s because I don’t know my way around Android development.
I think cross-platform mobile frameworks are a good solution for native mobile engineers who want to deploy apps on the other platform — for example, an Android developer wanting to deploy their app on iOS. I also think cross-platform technologies are great for non-mobile developers wanting to get into mobile development. For example, frontend web developers will feel comfortable using React Native, Cordova, and Ionic.
When working with cross-platform frameworks, I found them to be really good at some things and not so great at some other things. They’re quite good for apps where you expect to build almost completely using the framework’s language itself, i.e JavaScript for React Native, Dart for Flutter, and so on. If you anticipate writing a lot of native code for specific platform features, cross-platform apps might not be the best choice. Again, these are just my opinions, and you could’ve had a different experience working with them. Below, I’ll list some of my opinionated pros and cons of cross-platform mobile frameworks.
Pros:
-
Live previews provide a great developer experience while creating an app. Being able to see the app change instantly as I write code really improved my productivity.
-
There’s no need to recompile between changes — this makes iterating really fast.
-
A unified codebase across two technologies means the surface area for bugs becomes smaller since you don’t have to maintain two separate codebases for iOS and Android.
-
Cross-platform frameworks allow you to have a consistent user interface and user experience across both platforms as a default.
-
There’s an active community and there are a lot of open source packages for the two most popular technologies, React Native and Flutter.
-
By maintaining a unified codebase, you can also have synchronized software release cycles across platforms.
-
Since React Native uses JavaScript bundles, apps can perform “code push” / “hot update” — basically, updating parts of the app on the fly without an entire app update.
-
It’s cheaper to develop cross-platform apps since you don’t require two separate teams for iOS and Android.
Cons:
-
To implement platform-specific functionality, you need native expertise. This negates the “write once, run everywhere” principle in practice.
-
There’s always a delay in adopting cutting-edge platform features. One must wait until a specific feature is officially supported by the cross-platform technology.
-
Cross-platform apps typically have worse performance compared to native apps, since there’s yet another layer of software.
-
Extra work is needed to make the app a good citizen of the platform. Features such as Dynamic Type, password autofill on Android or iOS, and even accessibility features — which are easy to support in a native app — require a lot of extra work to be implemented correctly in a cross-platform app.
-
Cross-platform technologies are more suited to making smaller, simpler apps. For more complicated apps, the overhead of maintaining platform-specific code, dependencies, tests, etc. quickly becomes too much.
-
Maintenance is non-trivial. Since there are so many layers — iOS, Android, native libraries, cross-platform libraries, etc. — it’s difficult to manage updates and versions for these different layers. Often, an update to one of these layers won’t be compatible with another layer or library, and you have to hold off an update until that incompatibility is resolved.
-
Warnings, warnings, warnings! Coming from an iOS developer background where we consider warnings to be errors, I was surprised by the fact that warnings are taken very lightly by cross-platform technologies and the community in general. As it stands right now, if I create a blank React Native app by following the official guidelines, I get 7,496 warnings when I open the project in Xcode. This ruins the whole purpose of warnings, because it becomes difficult to filter out the actual warnings from all the noise.
Conclusion
At the beginning of this article, I mentioned I wasn’t fond of cross-platform mobile frameworks a few years ago, the reason being my lack of knowledge and my own prejudice. As an iOS engineer, I believed that all mobile apps needed to be made using the intended programming languages and the development tools made by the operating system vendor.
I was very wrong. I believe mobile app development has matured and diverged and that all available technologies are welcome! After all, programming languages, integrated development environments (IDEs), design patterns, etc., are nothing more than tools that help us accomplish a task. As software developers, we have to choose the right tool for the job — just like Pablo Picasso used several brushes for his paintings.
To sum it up, there’s no perfect technology — hybrids and native have their own strengths and weaknesses, and as engineers, our duty is to identify the best solution for the project in front of us. Several companies — such as Airbnb and Dropbox — publicly announced their move away from cross-platform technologies, while other companies — such as Coinbase, Quizlet, and Shopify — have successfully been able to do the opposite and adopt cross-platform technologies at scale.
At PSPDFKit, we’re committed to providing PDF solutions that work for you across whichever platform you choose. So, in addition to our excellent iOS and Android SDKs, we also provide Flutter and React Native SDKs for all your PDF-related tasks.
To get started with PSPDFKit, check out our free trial. If you have any questions about our cross-platform PDF libraries, please don’t hesitate to reach out to us. We’re happy to help!