Development environments

Developers have two options when it comes to IDEs: Xamarin Studio or Visual Studio. This section will show you how to develop apps for both Android and iOS through both of these studios.

Using the Xamarin Studio environment

Xamarin Studio is a customized version of the MonoDevelop IDE and this can be used to develop applications for Android, iOS, and OS X. Xamarin Studio is available on both OS X and Windows with highly advanced and useful features such as:

  • Code completion
  • Smart syntax highlighting
  • Code navigation
  • Code tooltips
  • Integrated debugging for mobile apps running in emulators or on devices
  • Source control integration with Git and Subversion built-in

If you look at the following screenshot, you will see how Xamarin Studio is shown with the Android user interface designer opened:

Using the Xamarin Studio environment

Using Xamarin Studio to develop Android apps

Xamarin Studio and the Xamarin.Android add-in allow the complete development and debugging of Android apps without use of any other IDEs. The Android UI designer can also be used from within Xamarin Studio.

Using Xamarin Studio to develop iOS apps

Xamarin Studio and the Xamarin.iOS add-in allow the development and testing of iOS apps when installed on a Mac with Xcode and the iOS SDK. All code can be written, compiled, and debugged from within Xamarin Studio. In general, the user interface XIB and/or storyboard files must be built within Xcode; Xamarin Studio provides a link to Xcode such that when a xib or storyboard file is double-clicked on, Xcode will be launched.

There is a caveat to this; Xamarin has an iOS UI designer built for Xamarin Studio, yet it has remained in an alpha status for almost a year. I have seen a number of posts on various forums indicating it is stable and safe to use, but Xamarin has been slow to clarify why it is still in alpha status and when it will move to a stable status. We will discuss the use of the iOS UI designer in more detail in Chapter 4, Developing Your First iOS App with Xamarin.iOS.

Using the Visual Studio environment

Xamarin for Visual Studio is an add-in that supports the development of the Xamarin.Android and Xamarin.iOS apps and is available to business and enterprise subscribers. This add-in can be used with any non-Express edition of Visual Studio 2010 through to Version 2013. Android apps can be completely developed using Visual Studio. In order to develop iOS apps, you will still need a Mac with the iOS SDK and Xcode to compile and create the user interface xib and/or storyboard files.

Tip

If you already have a license for Visual Studio and are comfortable with the environment, this add-in will be better suited to you than Xamarin Studio due to it being simple to use.

The following screenshot shows Visual Studio 2012 with the Android user interface designer opened:

Using the Visual Studio environment

The Android user interface designer

Using Visual Studio to develop Android apps

The Visual Studio add-in for Xamarin.Android allows the full development and debugging of Android apps without the use of any other IDE. This add-in provides the usage of the Android UI designer from within Visual Studio. For those that have the appropriate licenses and are comfortable with Visual Studio, this might be the best option for Android development.

Using Visual Studio to develop iOS apps

The Visual Studio add-in for Xamarin.iOS allows you to develop and test iOS apps, but only in conjunction with the use of a Mac with both Xcode and the iOS SDK installed. The iOS code must be compiled and executed on a Mac using the Xamarin's mtbserver. Xcode on a Mac must also be used to develop the user interface xib and/or storyboard files for an iOS app. We will discuss this configuration in more detail in Chapter 4, Developing Your First iOS App with Xamarin.iOS.

Note

Solution and project files created and used by Xamarin Studio are completely compatible with Visual Studio. This gives teams the flexibility to choose which IDE to use and they can easily change throughout the duration of a project.

Comparing IDEs

The advantages and disadvantages of adopting each IDE are shown in the following table:

IDE

Pros

Cons

Xamarin Studio

Available for all Xamarin subscription levels

Runs on Windows and OS X

Limited number of productivity add-ins available

Does not offer support for the use of TFS for source control

Visual Studio

Most C# developers are already familiar and comfortable with Visual Studio

Allows the use of popular productivity add-ins such as ReShaper and CodeRush

Allows the use of TFS for source control and issue tracking

Requires a business or enterprise subscription of Xamarin

Requires a license of VS

Runs on Windows only

For iOS development, requires a more complex configuration in which VS must communicate with a Mac running Xcode to perform builds and UI development must be done with Xcode

Version control

Version control can be a challenge anytime you have a diverse set of development tools, and Xamarin certainly adds diversity to most shops. The challenge is making it easy to share and manage code from all of the different IDEs and client apps that folks will be working with; many times they do not have access to the same repositories. Since the benefits of using Xamarin are very attractive to existing .NET shops, many Xamarin developers will find themselves working in environments already committed to using Microsoft Team Foundation Server (TFS). Unfortunately, it's not always easy to connect to TFS from non-Microsoft tools. In the case of Xamarin Studio, there is an open source add-in that cannot be directly supported by Xamarin and can be challenging to configure.

Other version control systems to consider include Git and Subversion. Xamarin Studio contains built-in support for both Git and Subversion, and add-ins for both of these tools exist for Visual Studio. The following table contains useful URLs to download and read about the various add-ins:

Add-in

URL to access it

TFS add-in for Xamarin Studio

https://github.com/Indomitable/monodevelop-tfs-addin

Git for Visual Studio

(VS2013 has built-in support)

http://msdn.microsoft.com/en-us/library/hh850437.aspx

(VS2012 requires a free plugin)

http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c

Subversion add-in for Visual Studio (by VisualSVN)

http://www.visualsvn.com/visualsvn/?gclid=CMmSnY-opL0CFa07MgodDksA5g

Like many aspects of software development, there is not a "one size fits all". The following table outlines some of the pros and cons to consider when deciding on a source control solution for Xamarin projects:

VCS Tool

Pros

Cons

TFS

Already in use by many shops that will consider Xamarin.

Free add-in for Xamarin Studio.

Xamarin Studio add-in has been known to be problematic to use in the past.

Git

Built-in support in Xamarin.

Free add-in available for Visual Studio 2012 and 2013.

Difficult to share and synchronize code with other teams in a large organization that might be using TFS for their C# code.

Subversion

Built-in support in Xamarin Studio.

Commercial add-in for Visual Studio.

Difficult to share and synchronize code with other teams in a large organization that might be using TFS for their C# code.

If you already have a significant investment in using TFS, try to make that work for your Xamarin development as well. This can be done by either having developers use Visual Studio or trying your luck with the TFS add-in for Xamarin Studio.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset