Join Adrian Stevens for an in-depth discussion in this video Introducing the development tools, part of Introduction to Xamarin.iOS.
- [Narrator] In this video, we will introduce the development tools you will use to create your first application using the built-in project templates in your IDE. As you probably remember from XAM101, in order to build Xamarin iOS applications, you will need a Mac running the latest released version of MacOSX along with the latest released version of Xcode. Apple requires that developers upgrade to the latest versions of everything, and the Xamarin tools are updated to match so we recommend you keep Xcode up to date, and up to date with the latest Xamarin stable releases as they are pushed to the stable channel.
Xamarin iOS includes both compile time and run time components, including a cross-platform C# compiler that is fully compliant with the latest C# specifications. This is used specifically on the Mac. Visual Studio uses Microsoft C# compiler. An optimizing Native code compiler and linker which is used to create the Native code that Apple's tools will expect to work with. A runtime engine which will provide checking static reflection, inter-op and garbage collection services to your app. This runtime engine also includes the runtime binding definitions for all of the released iOS API's.
Finally, the runtime includes the subset of the .Net framework class libraries based on the shipped 4.5 assemblies for Microsoft. This includes features like Link, Tasks, XML, Regex, iO, and networking API's. There are two IDE choices available. For Windows users there is support for Visual Studio 2012 and up including the free edition of 2015, which you can install Xamarin right from the Visual Studio installer. Older versions require you to run the Xamarin installer.
Still you'll need a Mac with OSX and Xcode plus the Xamarin tools to use as a build host. For Mac you can use Xamarin Studio which is a customized version of the open-source mono-develop IDE. It looks and behaves very similarly to Visual Studio. Whichever IDE you choose to use, we recommend you run on stable channel, and stay up to date. No matter which IDE you decide to use your application adventure will begin with File - New Project. Both IDE's have a set of installed project templates to create iOS applications in a few different styles.
The app creation experience is a little different between each of them. The first project style is the Single-View Application. It's the simplest application template, and the one you'll be using later in this course. It creates the app structure with a single empty page declared in a designer file ready for you to add controls to. Many applications start with this template. The second template is the Master Detail App. This creates an application with two views. The Master view which is a list of scroll able records, each one representing some piece of data, and the Detail view which displays one single record.
This template also supports a combined master-detail view on tablets in landscape mode. For data-driven apps like Email or Tasks, this is a great template to start with. We cover this template in more detail in the IOS205 Navigation Patterns course. Next we have the Page-Based App. This creates a single screen application that let's you swipe through different pages of information, sort of like a book. If you are trying to build an app where the screen remains consistent, but you are swiping between pages of related information, this is a great starting point.
The IOS205 course also discusses this template. Next we have the WebView App. This creates a hybrid app which hosts an HTML WebView control. Content is shipped locally with the app as asp.net razor pages. They are not server based. This is a good choice if you have a significant investment in HTML and CSS but need a native app. The last choice is a Tabbed App template. This creates a multi-page application where each page is a tab with a button representing it on the bottom of the screen.
If you are building an app with multiple distinct pages that may or may not have relationships, this is probably the template for you. Once you've created your project you can build it. To compile your code, you will use the same technique you would for any other app. The Run button on the Toolbar menu or the Accelerator key for the hardcore developers. Build Warnings and Errors will be reported through the Error window, which you can turn on and off through the View Menu. You have a couple of options when testing your application.
First is the iPhone simulator. This is a Mac only tool supplied with Xcode. It simulates an iOS environment on the Mac. You can select different form factors directly from the toolbar, and you can download older versions of iOS using Xcode. You must have remote desktop access to your build host if you are using Visual Studio. Your other option when testing your application is to use a physical device. You can connect an iDevice to your Mac with a USB cable, and both IDE's will detect it.
You must select the iPhone build configuration in Visual Studio to create a native AOT package. Xamarin studio will automatically select the proper configuration based on the device you are deploying to. Running on a physical device is actually a great way to test your app. You should always do this during your development cycle due to runtime differences. But it does require some set-up. Apps must be signed with an Apple supplied certificate and devices must be registered with the Apple developer portal.
This course was created by Xamarin University. We are honored to host this training in our library.