This week I have the opportunity to attend the VS Live Conference Las Vegas 2018 being held at Ballys Las Vegas from March 11th to March 16th. The conference is divided into Pre-Conference Hands-On Labs, Pre-Conference Workshops and Breakout sessions.
On Day 1 I had the opportunity to attend “From 0-60 in a day with Xamarin and Xamarin.Forms” presented by Roy Cornelissen & Marcel de Vries.
Here are some key takeaways from the session that was presented –
Testing your Xamarin App: Xamarin does allow you to test your apps in the Xamarin Test Cloud. Please refer to https://www.xamarin.com/test-cloud. This link will provide you a list of devices that can be tested. As per the website, there are around 3410 devices on which you can test your app on. Android has around 1551 devices and iOS has around 1859 devices. You can automate your testing. Microsoft has created a framework called Calabash that can automate and test any iOS or Android app, native or hybrid, from the UI level down. You will need to create an account on Visual Studio App Center Test since this is the next generation of Xamarin Test Cloud. Please refer to the Visual Studio App Center for more information.
Architecting Mobile Apps: There are multiple approaches that are in place for building mobile apps.
- Silo Approach: This is the current way of building apps using the preferred languages. For iOS Objective C, for Android Java and for Windows (if anyone is still using Windows Phone :)) is C#. The issue with this approach is –
- No Shared Code
- Many languages & development environments.
- Multiple Teams.
- Limited native API access.
- Slow Performance. Please refer to a Mobile App Performance Redux for in-depth analysis.
- Poor user experience.
- Xamarin’s Approach: This allows the developers to write your code in C# and can be used on any platform. The base line is that C# utilizes the base system libraries and each platform has their unique libraries to access the unique APIs. This approach helps with –
- Shared C# code.
- 100% native API access
- High Performance
Native Performance: Each platform has different way of compiling the apps.
- Xamarin.iOS: Utilizes full Ahead of Time (AOT) compilation to produce an ARM binary for Apple’s App Store.
- Xamarin.Android: Takes advantage of Just In Time (JIT) compilation on the Android device.
Debugging your App:
- iOS: For this you do need Apple Computer running iOS. You need to use the following instructions for debugging your app – https://developer.xamarin.com/guides/ios/getting_started/installation/windows/connecting-to-mac/
- Android – You can download Visual Studio Emulator for Android from this link. In the session, we did face some issues with the emulator not starting. I have blogged on how I fixed the emulator issue on my laptop. But I also did set up my Galaxy S8 to debug the app since the instructors recommended device for debugging the app as an efficient way. You can follow the instructions at https://developer.xamarin.com/guides/android/getting_started/installation/set_up_device_for_development/ to setup your android device for debugging.
Xamarin Forms: You can build native UIs for iOS, Android and Windows from a single, shared C# codebase.
- So whats included –
- 40+ Pages, layouts and controls.
- coding done with XAML.
- Two way data binding
- Animation API
- Dependency Service
- Messaging Center
- Native UI from shared code.
- Required Components
- Application: This provides initialization for the application. Common events that are handled – OnStart, OnSleep and OnResume.
- Pages: Represents a single screen to display.
Shared Code: So far, developers had 2 options on deciding what to choose for shared code –
- Shared Projects – with conditional compilation and source code sharing across platforms.
- Portable Class Library – additional project in solution that is referenced by platform specific projects
- .NET Standard Project – .NET standard is a specification of .NET APIs that can be used and are available on all .NET implementations (including Xamarin platform projects like iOS, Android or UWP). It is quite similar to PCL, but it’s easier to use and has more classes available from BCL. If you are interested in knowing whether it is time to move from PCL to .NET standard please refer to this link.
The session did provide me enough information to play around with building my first mobile app someday soon. 🙂