Setting up the native platform projects
Now we move on to the native platform layer and prepare the iOS, Android, and Windows Phone projects. We are going to start with iOS; let's start by adding the NuGet packages required for the project:
Microsoft HTTP client libraries
Modern HTTP client
Autofac
Reactive extensions (main library)
Once we've added these packages to the project, let's open the AppDelegate
file and add the same InitIoC
function we used in the Locator
project:
private void InitIoC() { IoC.CreateContainer(); IoC.RegisterModule(new DroidModule()); IoC.RegisterModule(new SharedModule(false)); IoC.RegisterModule(new XamFormsModule()); IoC.RegisterModule(new PortableModule()); IoC.StartContainer(); }
Then call this method before we load the application:
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); ...