Xamarin for iOS and Android Development: The Fors and Againsts
“If you can afford it, use Native” is one of the most common things you get to hear when it comes to selecting which technology to use for mobile app development.
The reality of it is usually not that straight-forward. The questions that should be asked before development would be on the lines of – What is the type of application being developed? Will it be only for iOS, Android, both, or more platforms? Will it be animation-heavy and/or graphics-heavy, with a unique and intricate UI? What is the business logic being followed?
Depending on the project’s budget, specifics and a myriad of other factors, going for hybrid development or near-native can save a lot of resources and time without compromising much in terms of performance and looks.
Currently, the multi-platform app development biggies include (but aren’t limited to) platforms/frameworks like Xamarin, React Native, Flutter, PhoneGap, and Cordova. Our focus in this blog will primarily be on Xamarin and it’s pros and cons for iOS app development and Android app development.
Having its roots in the Mono project, Xamarin was integrated into the .NET platform after being acquired by Microsoft in 2016. It has now emerged to be a highly popular open-source framework for cross-platform mobile development. A single tech stack of Xamarin, C#, and .NET, augmented by the ability to reuse up to 95% of the code, facilitates the ridiculously easy creation of mobile applications for iOS, Android and Windows OS (when compared to Native).
Pros of using Xamarin for mobile application development
Write once, use everywhere
The main selling point of Xamarin and similar frameworks is the possibility of building single-code solutions for iOS and Android. Written in C# in the .NET framework, it can provide up to 95% reusable code with controls, user interface, and native performance.
Technical backing and support from Microsoft
The fact that Microsoft’s software development bundle includes Xamarin places it above many competitors because of guaranteed continuous developer support, performance, and stability (especially for products like Test Cloud).
C# and .NET flexibility
The nature of C# and .NET, as well as, the “.NET for everything” view of Microsoft allows easy switching by design between applications for various platforms for a single development team.
Native performance and UX
Because it is possible to access each and every native API, one can take full advantage of the hardware-specific and system-specific APIs. It’s hard to tell the difference between a Native app and one made in Xamarin because there isn’t one. The Xamarin.Android and Xamarin.iOS libraries can handle the non-overlapping native APIs, while the Xamarin.Essentials library handles the rest.
Reduced time-to-market
Having shared codebases eliminates the time spent on recompiling, rewriting, or translating the code to work on different operating systems. This has the potential to cut weeks, months, and possibly, years off of the SDLC. The features in the application won’t trickle down – they’ll be ready for deployment to all the platforms in one go.
Track activity and crashes
Visual Studio App Center allows tracking of user activities, devices, app crashes, and much more. Thus, QA becomes more fluid and effortless. Because of .NET, one can oversee, build, and test not only Xamarin projects but also native iOS, Android, and Windows apps, all in one place.
Rapid GUI prototyping
With Xamarin.Forms, one has access to a cross-platform UI toolkit to build UIs that work on any device. This can bring reused code percentage up to a whopping 95%, skyrocketing development speed and driving down costs.
Maintenance
If new features, bug fixes, or updates become necessary, changes to the source file are directly applied to all applications, thereby, eliminating the need to update the source code individually.
You can also check out: React Native vs Xamarin
Cons of using Xamarin for mobile application development
Cost of license
Since it’s a part of the .NET platform, Xamarin is open-source and free. However, for developing commercially, Microsoft Visual Studio IDE is required, and the license isn’t considered a cheap one. Although there is a Community license option available free of cost, some features like automated tools for testing, multiple account support, and collaboration options are only available with Enterprise Subscription option.
Limitation in platform-specific features
Some limitations are bound to happen, no matter how close to native development one can get. In Xamarin, as an example, multi-touch functionality and platform-specific gestures require some workarounds.
Some more examples of the platform-specific limitations of Xamarin can be seen in the table below:
Xamarin.Android
- Partial Java generics support
- Limited Java generation support
- Limited dynamic language support
Xamarin.iOS
- Runtime features disabled
- No remoting
- No dynamic code generation
- Limited generics support
Overhead of code
Xamarin can be overcomplicated to facilitate smoother integration. Since native applications don’t require shared functionality, applications built in Xamarin are heavier and can take up more space. However, Microsoft is actively working on resolving this, Xamarin.Forms and Xamarin.Essentials being the greatest contributors.
Lag in API support
There can exist a bottleneck when it comes to supporting for latest releases for Android and iOS since proper integration will be needed for Xamarin.Android and Xamarin.iOS libraries and APIs.
Not recommended for graphics-heavy applications
The UI development for each platform needs to be done separately, whether Xamarin.Forms is being used or not. Consequently, applications that employ heavy use of graphics should really be developed in native.
Conclusion
Xamarin is one of the most productive, extensive, and robust frameworks for cross-platform application development, even when considering its flaws and limitations. With a growing community of developers and Microsoft’s strong backing, the flaws are being taken care of. Additionally, the ease of deployment, native and cross-platform libraries and APIs, and the powerful C# environment prove to be extremely useful for keeping costs low, and at the same time, delivering new features to all customers faster.
The one thing to consider is that the project’s budget, specifics, business logic, etc., that were mentioned above, should drive the decision between using Xamarin or going native. At Algoworks, we have experienced teams for both Xamarin app developers and Native Mobile who can ensure that you chose the right option!
Blog source: https://www.algoworks.com/blog/xamarin-for-ios-and-android-development-the-fors-and-againsts/