Add ios project to xamarin forms solution with droid project

I have a xamarin forms solution with pcl and .Droid project. Now I also want to add ios to the solution. How should I do it. In the add dialog I can select a new project, but it seems to add a lot more ... So the solution was first created without the ios checkbox ....

by the way. I am using xamarin studio

Regards

+3


source to share


2 answers


  • Add a new empty iOS project.
  • Add Xamarin.Forms Nuget Package.
  • Substitute the AppDelegate class like this:


[Register ("AppDelegate")]
public class AppDelegate : FormsApplicationDelegate
{
    public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
    {
        Xamarin.Forms.Forms.Init();

        LoadApplication (new App ());

        return base.FinishedLaunching(application, launchOptions);
    }
}

      

+3


source


There is no Xamarin.Forms project template that does this out of the box. Xamarin.Forms project templates are self-contained and ready to run once they are created, so they will always create a PCL project or a Shared Asset project.

Arthur's answer about creating a new empty iOS project, adding the Xamarin.Forms NuGet package, and then changing the AppDelegate is a good approach. Although it is missing:

  1. Add link from iOS project to PCL project.


If you compare this to an iOS project created using an empty project versus one created using the Xamarin.Forms project template, they are slightly different. So an alternative to creating a new empty iOS project would be:

  • Create a new Xamarin.Forms solution with the iOS checkbox checked.
  • Copy your iOS project to a folder inside your existing solution.
  • Add your iOS project to your existing solution.
  • Add a link from your iOS project to your PCL project.

You can try adding a new Xamarin.Forms project to an existing solution using the New Project dialog without creating it separately. I would do this carefully to try and overwrite existing project files. If you have already done so, you will be able to delete the new PCL project he added as well as the new UITests project he added. Then add the link from the iOS project to the PCL project.

+3


source







All Articles