Home > Mobile >  What does it mean for Xamarin to share an average of 80-90 percent of the code across platforms?
What does it mean for Xamarin to share an average of 80-90 percent of the code across platforms?

Time:08-11

I have been looking into Xamarin for mobile app development because it allows one code to be used for both Android and IOS. Microsoft says that "In most cases, 80% of application code is sharable using Xamarin."

So my questions are:

  1. What does that mean exactly? why only 80%?
  2. What is not sharable using Xamarin?

CodePudding user response:

Things that are platform agnostic - models, data, services, etc - can be put in a pure .NET library and shared between projects.

If you use Xamarin Forms, then you can also share UI code between platforms. If you are not using XF then the UI for each platform will not be shared.

Finally, platform specific features - camera, GPS, push notifications, backgrounding, etc - will need to be per-platform. However, in many cases there are libraries or nuget packages that will provide a common API between platforms that you can use in your shared code.

  • Related