Beer and Xamarin.Forms – Anatomy of a Xamarin.iOS Project

In this lesson

  • Adding Components
  • Adding Nuget packages
  • Adding project references
  • info.plist and entitlements.plist files

Transcript

Tap on time to skip ahead

00:10

A Xamarin.iOS project built via the Forms wizard has a handful of elements that we’re going to cover. First, like a lot of Xamarin.iOS or Android projects, we have access to the Xamarin Components Store. If you open up the Components Store, you can see that there’s a wide variety of community created components, libraries and stuff that you can add to your application to improve your development experience.

00:38

Much like any project in .Net, we can specify different project references, DLL references, as well as any other built-in packages or namespaces that we want to add to our project.

00:55

We can also, if we don’t want to use a Components Store, we can also use NuGet to install packages. For example, we are probably be going to use json.net in our project. I can easily add that package and then instantly have access to that library. Something else you may notice is the Resources directory. This is where we’ll put various static assets, like images, in this particular case we already have an image set for our app icon, as well as the particular iOS nib view that we want to use for our launch screen.

01:31

When our iOS application is first installed in launch, the main C# class will be our entry point. If you take a look at the source code of main.cs, you will see that it is specifying our AppDelegate class as the delegate our application should use. If we open up the AppDelegate.cs file, we’ll see that we have a finish launching method here. Inside here, we see that we’re initializing forms, loading up the application, then we just do the standard return of the base method invocations.

02:07

Some other things that are of interest with a Xamarin.Forms iOS project, is the entitlements plist. This file also exists in all iOS applications. You use this file to specify that you want access to certain parts of the iOS infrastructure. These things can include access to iCloud, Passbook, Apple Pay, Keychain, etc.

02:33

Lastly, we have our info.plist file. This acts as the metadata file for our application. As you can see we have the name of our application, the unique bundle identifier for said application, the version number that we are currently working on, as well as the build number.

02:52

We can also specify if we want our application to just be iPhone or iPad or universal. We can also specify the status bar styles, as well as specify the iPad deployment info if this was indeed an iPad project. Here again, we can specify app icons, launch images if we don’t want to use iOS nib view. Then, we can also specify the iTunes artwork for our application and whether or not we need map integration, as well as what type of background modes we wish to support in our application.