Korken55
Korken55

Reputation: 253

Xamarin.Forms PCL

i was just wondering what the benefits are in using PCL with Xamarin.Forms. I mean you share the Code between each Platform anyway. In Xamarins native approach it is quite clear. So maybe anybody can tell me why to use PCL in Xamarin.Forms?

Upvotes: 0

Views: 539

Answers (2)

In addition of maximum code sharing, it allows you to follow best practices like SOLID.

Also, please remember that there are 3 choices (not only 2):

  • Portable Class Library
  • Shared Library
  • .NET Standard Library

.NET Standard Library is still an ongoing work in process, so it's not there yet. But, it will be the way to go!. So, PCLs today can give you an excelent migration path to the .NET Standard Library way tomorrow.

Hope this helps.

Upvotes: 2

Dan Siegel
Dan Siegel

Reputation: 5799

PCL allows the maximum in code sharing across platforms. PCL will by it's very nature limit you to using only those API's that can be shared from platform to platform.

While you can use Shared Projects, you will find yourself using compiler directives and making coding sacrifices that can lead to bad coding practices across anything but the smallest of projects.

Using the Xamarin Forms 2.3.3 or later you can of course embed Platform Specific Controls in your Xamarin Forms pages in your PCL and they will only render when run on the platform.

Upvotes: 5

Related Questions