Adding a Xamarin Form to Xamarin iOS unified app - xamarin

I have a Xamarin iOS unified app.
I want to add a Xamarin form to it.
How can I do this?
Thanks,
Kaustubh

-You can not do it directly.
-Create a Xamarin PCL project, it will create a shared project and native projects to iOS and Android
-You can add you Xamarin native project, necessary files to it
-Create a page renderer in Xamarin Forms Shared project
-Use it to load required page from native project
-Page renderer will act as a native page.You can call your native functions, UI from that point onwards.

Xamarin forms is a kind of project, not a form you can add to a project that is not xamarin forms
You can just add a new project of type Xamarin.Forms in your solution and you'll then have to port your code or share as much as possible through a PCL.
Source and reference : developer.xamarin.com/guides/cross-platform/xamarin-forms/
[Edited to take comments into accounts]

Related

Reuse Xamarin Forms page in Xamarin.IOS Project

My aim is to be able to reuse Xamarin Forms pages in my xamarin.ios project. I know that it is possible for ios extensions. However, can it be achieved in an xamarin.ios application project?

No portable class library folder found in Xamarin Forms

I am a newbie working with Xamarin Forms in Visual studio 2019.
When I create a blank page for Mobile App(Xamarin.Forms) , I do not see a Xamarin.forms portable template app in my project solution.
There is no PCL anymore. PCL is outdated. Just use the Mobile App (Xamarin.Forms) template. It will create all you need.
The core project (that contains your shared code) will be a .net standard project.
.net standard is way better than PCL, because you don't have a artificially limited set of APIs.
this creates the following 3 projects
Your shared code should go into the App8 project

How to use Xamarin in existing iOS or Android Project?

I have an iOS project written in Swift.
I want to launch Xamarin.Forms Views inside iOS Native Project.
How to do two way communication from iOS Native Project to Xamarin.Forms view?
is there any way to achieve this task?
Ex. I can achieve this task using Flutter Module.
https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps
https://medium.com/flutter-community/add-flutter-to-existing-android-ios-app-ae8c4fb1582e
How to achieve above using Xamarin?
You maybe can di that with the Embeddinator-4000 that creates native libraries of .NET libraries. https://github.com/mono/Embeddinator-4000
This can be done with Xamarin Forms Native Views

Move from Xamarin to native(Swift/Kotlin)?

We currently have an app in Xamarin, which is Xamarin.Android and Xamarin.iOS with a shared PCL (no Xamarin.Forms). It currently is a very complicated app and we would like to remake screen by screen the app, and move away from Xamarin to a Swift and a Kotlin app in the meantime.
Is this possible? We don't have the time nor money to remake the app completely at once.
I have looked into making new screens as external libraries, and then bind that library, but I think that's making it a bit too complicated.
you can reuse the assets and resources only but not the code because you are using Xamarin.Forms not Xamarin.Android + Xamarin.iOS.
in your project you don't have any android XML design files and no iOS storyboard even the logic is different with the .cs files because you are not using the Android Java SDK or iOS SDK directly.
If you were use mono and mono touch directly without using the PCL (Xamarin.Forms) project then you can rewrite the code with minor changes with names of method, properties... etc.

XAML in Xamarin.iOS and Xamarin.Android

I was giving an interview for a company and I was told by the architect that they are creating iOS apps from Xamarin.iOS ( NOT Xamarin Forms) with MvvmCross framework and they use storyboards for UI. But if the UI is very simple they use XAML to create them.
I never knew we can use XAML for Xamarin.iOS and Xamarin.Droid. We had a small discussion/argument if that's even possible. He said they were using it successfully.
My question, is it really possible to use XAML in Xamarin.iOS and Xamarin.Droid. Because, if we can do that, I feel no use of using Xamarin forms.
If yes, can anyone provide some kind of documentation?
Thank you.
There is no way to design UI in XAML using Xamarin.Android or Xamarin.iOS, but you can include Xamarin.Forms page in Xamarin.Android or Xamarin.iOS app. This way you can have native app with UI using storyboards, but with some Xamarin.Forms pages designed in XAML.
There is a sample how to do that in Xamarin Forms samples project on GitHub.
Only Xamarin Forms support sharing of UI via XAML.
UI for iOS has to be made using xib or storyboard.
For Android using AXML.
Windows Phone, UWP, WinPhone Silverlight, Windows can use XAML for UI.

Resources