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. We have been happy working with Xamarin, but when we recently heard of a complementary framework, Prism, that makes working in Xamarin even easier, we just had 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 ensures the community is continually nurturing and taking care of the technology before we commit to using it, and we were happy to see this absolutely is the case with Prism.
Benefits to Using 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 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.
Challenges to Using Prism
There were, of course, a few challenges to using Prism as well. While working with Prism, we learned 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. But when we integrated Prism fresh in a new project, it caused no problems at all.
Additionally, we ran into an issue with our selected .NET IoC container not working correctly. We eventually learned that the IoC container was not as up-to-date as we thought, and a quick search gave us ideas of better-suited IoC containers. 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, our 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 streamlined our processes. If you’re looking for a mobile app team that can help you reach your goals, contact us.