Creating a native custom control using Xamarin.iOS and Xamarin.Droid

134 views Asked by At

I need to create a native Android custom control that Java developers could use in a native Java Android app and also create a native iOS custom control that iOS devs could use in their Swift or Objective-C iOS project.

Could this be done using Xamarin.Droid and Xamarin.iOS ?

I find a few articles on how one could use a third party custom control in Xamarin, but nothing on how to create one for Android and another for iOS.

I do know I can't have a single code base that targets both, what I want is to be able to create two "projects", one being a Xamarin.Droid Project and the other a Xamarin.iOS project that would generate respectively a Android Custom Control and a iOS Custom Control.

I surely must be taking this the wrong way, because I find nothing.

2

There are 2 answers

0
Leo Zhu On BEST ANSWER

You may try to use Embeddinator-4000.It is a tool to turn existing .NET libraries into libraries that can be consumed by other languages.

Presently there is support for .NET to C, Objective-C (across the various Apple platforms) and Java (Android and regular Java), across Windows, Linux and macOS platforms.

1
Ivan Ičin On

Xamarin projects can't output to the Java or Objective C library, so no it is not possible. Aside from the fact that there is no UI entry to create such a project there are huge technical problems if someone wanted to achieve something like this. Not to say that it would be completely impossible, but not sure if it would be reasonable for anyone to create support for something like that considering costs/benefits of building such a technology.