During the next ten days, you will be learning to use Xamarin for iOS and Android native app development. By the end of this couple of weeks, you will be able to build your apps with C# and XAML and deploy them to both Android and iOS.
But before we get to that, you should complete a few steps that will get your computer ready for Xamarin development.
What is Xamarin?
Since you are interested in 10 Days of Xamarin, I’m guessing you already know what Xamarin is. Nevertheless, for those not aware of the benefits and features of the platform, this tiny section will explain what you can expect. If you are already familiar with the tool, feel free to skip to the “Setting up the Environment for Xamarin development” section.
Things to keep in mind
The latest version of Windows or macOS is highly recommended. While you may be able to run a previous version of Xamarin in OSs as old as Windows 7, these versions lack a lot of features that are only available in newer versions of the Windows and Mac operating systems. This series covers some of the latest features and will be based on the assumption that you are running the most recent versions available.
If you own a Windows computer, you will be able to write code for Windows, iOS, Android, and even other platforms. However, you will not be able to test your iOS apps unless you have a Mac computer -with all the tools installed- available in the same network.
If you own a Mac computer, you will also be able to write code for Windows, iOS, Android, and other platforms (although the Windows project can only be created from a Windows computer). However, you will not be able to test your Windows apps unless you copy your code over to a Windows PC.
Finally, a physical device is highly recommended. The ideal setup should include an iOS and an Android device running reasonably new versions of their respective OSs.
Features of the platform
The most significant selling point of Xamarin is to provide C# developers with the ability to create entirely-native iOS and Android apps that share up to 100% of the code (including the definition of the interfaces).
But even for those of you not familiar with the C# language, that is a pretty big deal.
To be able to define the UI once and have Xamarin translate that UI into entirely native elements for both Android and iOS is very cool.
And did I mention you can code the functionality once and have it also be compiled natively for both platforms (I mention only Android and iOS, but more platforms are supported)?
There are a ton of amazing features to include in this post, but let me mention a few that I think are very important:
- Binding libraries, which allow you to use native Java and Objective-C libraries within your Xamarin projects.
- Custom Renderers, which will enable you to add custom native functionality to shared UI elements.
- Dependency Services, which allow you to use the platform-specific code in a shared, reusable way.
Benefits of using Xamarin
If you have created apps with C# and XAML in the past, learning Xamarin is a no brainer. It helps you use all of that knowledge to build fully native Android and iOS apps.
And if you are only starting up your career as a mobile developer, Xamarin is a great tool to start. It will allow you to deploy to -at least- two platforms with the effort of coding only one. That’s the dream.
Setting up the Environment for Xamarin development
Mac only: Make sure that you install the iOS SDK before moving to the next step. This is included only with Xcode, so you will need to open the Mac App Store, search Xcode (Apple’s IDE) and install it. By doing so, the iOS SDK (and some other essential tools) will be added to your environment. Make sure that after you install Xcode, you open it at least once for it to finish setting up.
Eventually, Visual Studio will use the installed tools when you are developing, testing, and deploying your iOS apps, but you will rarely need to open Xcode after that.
The universal place to get started when setting up your environment for Xamarin development is visualstudio.com, there you will find the appropriate download button for your operating system, so whether you are using a Windows or a Mac computer, you can download the corresponding version of Visual Studio.
From there, install Visual Studio.
Installing on Windows
Installing on macOS
Connecting to a Mac computer from Visual Studio on Windows
Like I mentioned at the beginning of this post, if you want to test your iOS applications from your Windows computer, you will need to connect Visual Studio to a Mac computer that can be found in the same network. This computer will need to have all the tools installed, so make sure you follow the instructions above.
If you don’t own a Mac computer, connecting to one once in a while will allow you to test your apps on an iOS simulator/device and deploy to the store, but while you can do that, rest assured that if your app works on Android, it will very likely work on iOS as well. Remember that we aim for 100% code reuse, so testing on one platform will be enough in most cases.
But of course, it is always necessary to be 100% sure that it works on both platforms by testing on a simulator or device. So here are the instructions for you to connect to a Mac computer from Visual Studio.
You are now ready to start creating Android and iOS apps with Xamarin. Tomorrow you will learn to create a Xamarin Forms project, and code an enhanced Hello World app to get your Xamarin developer career started.
2 thoughts on “Day 0”