Reputation: 359
I can't find a portable template for Xamarin Native in Visual Studio 2017. As you can see in the screenshot
But I want to make the Xamarin. Android and Xamarin.iOS as a cross-platform but I'm not getting the portable template for that. But I have seen in some places there are templates where we can get a portable file for Native Xamarin as well. You can see the screenshot below
Any suggestion how can I get the portable file for native Xamarin. The main reason why I need the portable file is that I wanted to do code sharing between Xamarin.android and Xamarin.iOS.
Upvotes: 0
Views: 426
Reputation: 16439
See I think you have a little confusion, How it basically works is Xamarin.iOS
uses the native iOS objective-c
behaviour having storyboards and view controllers, Xamarin.Android
uses the native java behaviour using xmls, activities, fragments. And Xamarin.Forms
is a cross-platform dev tool that works on both at the same time using XAML with all three working in a C# code-behind environment.
Now if you add a PCL or.NetStandard to your Xamarin.Android and Xamarin.iOS projects you can use them to write common code for eg: Business layers, services etc but you cannot reference them to each other like an Android
project cannot reference iOS
and vice versa.
But on the other hand, you can have a common service layer using a .Net Standard
library while using Xamarin.Android/iOS
which can use the same models(almost all the time) and services.
Note that Xamarin-Forms
.Net standard and PCL's are the same, But until and unless you add the Xamarin.Forms
package and do the necessary changes that are required for forms your application will pretty much be a Xamarin.Android/Xamarin.iOS project, with a .Net standard or a PCL as a project reference.
Also, note that PCL's are deprecated and hence it is recommended by xamarin that you use .Net standard libraries,
Curious about the difference between them? check this out
For a better understanding of what PCL and .Net standard is you can check the below links:
PCL: https://learn.microsoft.com/en-us/xamarin/cross-platform/app-fundamentals/pcl?tabs=windows
.Net Standard : https://learn.microsoft.com/en-us/dotnet/standard/net-standard
Upvotes: 1