Embeddinator-4000
Embeddinator-4000 copied to clipboard
Expose non-Java.Lang.Object C# objects to Java if possible
As the subject says, it appears to be impossible at the moment to meaningfully use Embeddinator-4000 to actually share code between iOS and Android, since only Java.Lang.Object
subclasses are exposed to Java. I'm primarily an iOS developer, so it's entirely possible there's some aspect of Java that makes this impossible or extremely difficult, but without this Embeddinator-4000 doesn't do the primary thing I'd think most people would want it for. If you can't expose C# objects to the native code, why not write the whole thing in Xamarin in the first place?
Just thought I’d add some of my own feedback, the reason why I use embeddinator is we provide our application as a framework. One of our clients have a standard objc project and won’t rewrite. So being able to embeddinate allows us to provide to them our framework but also other projects that can use C# from one code base.
Regards
Peter
On Aug 30, 2018, at 10:46 AM, Robert Thompson <[email protected]mailto:[email protected]> wrote:
As the subject says, it appears to be impossible at the moment to meaningfully use Embeddinator-4000 to actually share code between iOS and Android, since only Java.Lang.Object subclasses are exposed to Java. I'm primarily an iOS developer, so it's entirely possible there's some aspect of Java that makes this impossible or extremely difficult, but without this Embeddinator-4000 doesn't do the primary thing I'd think most people would want it for. If you can't expose C# objects to the native code, why not write the whole thing in Xamarin in the first place?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mono/Embeddinator-4000/issues/699, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAoCQ9CxYe2Z1PObba9Froe701K-MXtaks5uWCUHgaJpZM4WT7Wq.
So I've figured out a mildly inconvenient (but still inconvenient) workaround. You can do a "Shared Project" library, where the files themselves are shared between an Android class library and an iOS class library. Then you can use #if __ANDROID__
to add the necessary attributes to any public API surface.
This works, but it definitely could stand to be improved.
Thanks for reporting the issue. I'm tagging it with "java" so that the right developers can take a look.