“Everything you need to deliver great mobile apps” is Xamarin’s premise. This amazing software is being used by individuals who are developing apps for a wide variety of industries. Some firms such as JetBlue, Dutch Tax Office, Skulls of the Shogun game and McKesson are the perfect example to show how Xamarin can be applied to many different businesses and contexts.
During the last few years in UruIT, we have been developing cross platform mobile apps in an agile and efficient way. This has allowed us to create excellent user experience. Frameworks such as Ionic, Sencha Touch, and JQuery Mobile, along with wrappers like PhoneGap, have been successful to work with. However, we have realized that Xamarin is a step ahead.
Ever since Microsoft acquired Xamarin, the software has increased its popularity, and has been enhanced in many ways. Significant changes of tools, controls, and components, are being made continuously, with the aim of making existent and future apps work at their best.
The Xamarin world
Xamarin generates native applications for each mobile platform: Android, iOS and Windows Universal. We are able to do so thanks to the main libraries: MonoTouch y MonoDroid, since they allow us to develop in C# and compile in native code.
It is also important to highlight that from our C# code, we have unlimited access to Apple’s iOS SDK and Android’s API, which prevents us from losing functionalities. Besides, we can integrate codes in Objective-c language for iOS and Java for Android projects.
It takes a lot more than just code-generating tools in order to create great apps. The need for good quality and support strategies are very important in order to ensure a great design, performance and behavior on as many devices, platforms and fabricants as possible. Therefore, Xamarin’s products (including Test Cloud and Insights) offer an end-to-end solution in order to create high quality multi-platform compilations, tests, and follow ups.
There are 2 ways to implement this solution: One of them is traditional Xamarin (for Android and iOS), and the other one is Xamarin Forms. The latter one, which is more recent, has been exponentially growing. Not only does it share logic, as in all Xamarin projects, but also has the advantage of being able to share the User Interface (UI).
Let’s expand a bit on these two concepts:
This traditional tool, is utilized to generate native apps on Android and iOS. However, instead of creating them in their most common languages (Java in Android Studio, and Objective-C in xCode), they are developed in C# in combination with the power of .Net Base Class Library (BCL).
If we are looking for the best performance, as well as a complete handle of each and every functionality within the OS, while utilizing a great amount of features from the original SDK, and similar to native UI design, the best option would be working with traditional Xamarin. Although we would need to generate a project for each platform, as well as having to develop based on different paradigms, this will give us the advantage of doing everything as if it was native. However, we have to take into consideration that we are still allowed to share projects of logic in order to avoid duplicates.
So, this is what can be achieved with Xamarin:
- Native User Interface
- Native Performance
- Shared code across platforms
- C# & .NET Framework
- Full API Coverage
Speaking of improvements, last April during the Evolve 16, some of the changes made on Xamarin have been announced. These are the ones I consider more relevant:
Remote Simulator – Windows can now be used to run and test an iOS application. A simulator for iOS applications has been added, allowing us to stay on Windows simply by connecting a Mac to the net.
Usb remoting – An Iphone can be Debugged and/or Deployed only by connecting it to the usb port on Windows.
Workbooks – It is a way of sharing information live while creating a variety of documents such as tutorials, trainings and experiments. Occasionally, it can be used as playground, since it has integration with some APIs. This allows us to render controls, maps, and colors, among other feature.
As previously mentioned, this kind of project allows us to have not only a single shared code between platforms (iOs, Android, and Windows apps), but also the UI. The latter can be shared via Xaml files or by generating it from C# code, and that way obtaining a customized design for each platform. After the launching of the second version, XF has significantly improved the reported bugs and added new controls. Thanks to these positive changes, XF has gain a reputation as a development tool for high complexity projects. In its library, we can find Pages, Layouts and Controls, as well as Two-way Data Binding, Navigation, Animation API, Dependency Service, and Messaging Center.
If we are looking to customize the platform, we can always apply logic to this specific project, as if we were working with traditional Xamarin. The UIs are rendered utilizing each platform’s native controls in order to keep the look and feel of each OS.
As previously mentioned, ever since XF released the 2.x version, and also since Evolve 16, there have been many improvements, as well as the addition of some controls, styles and extensions, in order to be able to develop in a faster and easier way. Some of the most important changes are the following:
- Design Preview (UI) – Before XF, we couldn’t look at the changes in real time when working on a design with a Xaml file. Fortunately, since the creation of tools such as Gorilla Player, we were able to see our Xaml. However, it was not completely integrated to our IDE, and thus, we could not use it easily.
- Data Pages – It is a minimalist container that can be loaded with data from a Cloud Datasource or json.
- Themes – It allows us to define a specific theme in order to control the style of each of our controls, containers, etc. Light theme and Dark theme are predefined, however, customized themes can be created.
- Embedded Platform – (Stable) It allows us to add our own customized controls to our XF project in one line, without the need of customizing the render.
- Url navigation – Uses the search engines on mobile devices in order to come up as a recommended result and automatically open the App. This is not only an advantage for the app’s competitive ranking, but also for the user-app connection experience.
- XAML Power Toys – (Stable) It is an extension that allows to quickly create a data-bound and data entry forms from a viewmodel or entity class.
We have tested the above mentioned additions and they seem very promising. Therefore, we are now waiting for the final release of those that are pending. Some of them are known and work with stable versions, however, they still have been mentioned:
- XAML pre-compiled
- Android Material Design
- iOS9 support
- New gesture application
Based on previous experiences, we can say that a 70% of the code is shared, and that this percentage increases to a 85% approximately, if we use Xamarin Forms. The remaining code, is used for specific functionalities such as accessing the camera. In these particular cases, a specific code has to be applied to each project.
These days, there is a constantly increasing demand for mobile applications. It is common knowledge that apps with a lack of emphasis on user experience tend to be unsuccessful. Therefore, a need for native applications, with good quality, high performance, and amazing UX, is rapidly increasing in order to be competitive in the market.
Xamarin Solutions is considered a great tool for mobile development. It has the power to create either simple or complex native apps, in a short period of time, and with one development team only.
We’ll dive into reusability and components on our next post. Stay tuned!