Add platform to Xamarin project already created

Asked

Viewed 58 times

1

I started a project in Xamarin.Forms a priori only for Android and UWP and did all the programming in the Portable project. Is there any way I can insert the iOS project so that the modifications of the Portable project integrate with it?

1 answer

1


Yes. You will add the a new project of type iOS App in your solution, then install in it the package Xamarin.Forms from the NuGet (add the version corresponding to the one you are already using in other projects).

The next step would be for you to replace the content of override of the method FinishedLaunching in class AppDelegate which is automatically generated for it to boot the Xamarin.Forms. Your code will look something like this:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    // Inicializa o mecanismo do Xamarin Forms
    global::Xamarin.Forms.Forms.Init();
    // Começa a aplicação iOS nativa seguindo as especificações da classe App lá do seu projeto compartilhado
    LoadApplication(new App());

    return base.FinishedLaunching(app, options);
}

If you are making use of other packages or plugins that need to be initialized, this is the method you will be making use of, but you will certainly find more information on how to do it in the package/plugin documentation.

I hope I’ve helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.