visc
visc

Reputation: 4959

How do your write Xamarin platform specific code in a .net standard library?

How do your write Xamarin platform specific code in a .net standard library?

I want to use namespaces like Xamarin.Forms.Platform.iOS in a .Net Standard Library..

Use case: I want to develop a .net library for my apps which includes a video player for the various platforms. This video player also has to interact with other code in the .net library.

Or is the answer I need to use a shared project or portable library?

Upvotes: 0

Views: 500

Answers (1)

zpouip
zpouip

Reputation: 787

You should not include platform specific code or use namespaces like the one you mentioned in your .NET Standard Library, the reason is that .NET is just a runtime environment.

It’s not the the main runtime environment that you would use on iOS or Android. These platforms use Mono - not .NET. Check this or this to see more details for how its structured.

If you need to execute something from your .NET Standard project which is related to platform-specific behavior, use Dependency Injection or Custom Renderers.

Upvotes: 3

Related Questions