Why We Develop Mobile Apps with Prism for Xamarin
By: Nikki Dent
When it comes to writing mobile apps, developers have several tools at their disposal, one of which is Xamarin. If you decide that it’s a good fit for your project, Xamarin will help streamline development by creating native, cross platform mobile apps with one set of C# code. This helps developers work faster and with fewer headaches which, in turn, brings costs down. Overall, our team has been really happy working with Xamarin, but when we recently heard of a complementary framework, Prism, that makes working in Xamarin easier still, everyone was all ears to learn more and ready to try it out. Here’s what we learned.
What is Prism?
Prism is an open-source framework that originated for building Windows desktop apps, and it helps create XAML applications that are easy to maintain and to test. Key features of Prism that aid in development are MVVM design, dependency injection and commands. Whenever we use open source software, our team is sure to take a close look and make sure the community is continually nurturing and taking care of the technology before we sign on to using it, and we were happy to see that this absolutely is the case with Prism.
The Prism framework brings extra, more powerful features to your Xamarin instance. Where Xamarin reduces the amount of code needed for cross platform apps, Prism keeps that code even cleaner by eliminating the need for developers to take the time to code repetitive hookups with automation, creating easier to maintain code. Prism also allows developers to test their apps more efficiently, as dependencies are clear to the developer. Perhaps the best feature of Prism is that it makes it easy to navigate between pages while also providing all the proper context that’s needed as you move from page to page.
There were, of course, a few challenges to using Prism as well. In the course of working with Prism, we learned that it is best to integrate with Xamarin at the onset of a new project. We tried integrating Prism into a Xamarin project that was already underway and it caused a lot of headaches. For example, the initial Xamarin app didn't use the MVVM design pattern as it should with Prism and updating the app to use that design pattern and the Prism framework was more of a challenge than we expected. That said, when we integrated Prism fresh in a new project it caused no problems at all. Additionally, we ran into an issue with the .NET IoC container we chose not working quite right. We eventually learned that the IoC container was not as up-to-date as we thought, and a Google search offered ideas of IoC containers that would be better suited. Through this, we learned that using more up-to-date containers would ensure increased stability, both at the onset and over time. Once we made the switch, this solved the issue.
All in all, the Aptera developers have been very pleased with the use of Xamarin and Prism together. The clean and maintainable code, easy testing and time savings of this pairing has really streamlined our processes and it’s a setup that we’d recommend to other app developers.
Build Your Next Mobile App with Aptera
Could a custom mobile app transform the way you do business? Learn how Aptera’s partner-focused approach to development leads to successful applications.
About Nikki Dent
Nikki is a technical copywriter for Aptera. With a bachelor’s degree in writing from Saint Mary’s College, Notre Dame, Ind., she has been honing her craft of marketing copywriting for the past five years. In her role at Aptera, Nikki enjoys learning and writing about the technology and strategy at work across the company.