question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Platform-specific APIs.

See original GitHub issue

There are various APIs which are specific to a platform (i.e. have no corresponding APIs on other platforms) but would still be useful to be accessed from Avalonia.

One example of this which recently came up is NSWindowLevel on macOS: other platforms don’t have an equivalent so it doesn’t make sense as a general API, but still it’s really useful in certain situations to be able to set this for a window.

One way of providing these APIs might be as attached properties, for example one could set:

<Window MacOS.WindowLevel="FloatingWindow">

Such a property would only have effect when running on macOS.

The main question with regards to such APIs, is in which assembly should they live?

So, a few questions to start the ball rolling:

  • Is it a good idea to provide such APIs?
  • Which APIs might be good candidates?
  • Is the attached property idea a good one?
  • Where should the APIs live?

Issue Analytics

  • State:open
  • Created 4 months ago
  • Reactions:11
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
kekekekscommented, May 15, 2023

The support code can live where it wants to live, but the API should still be accessible when targeting netstandard2.0 with only Avalonia package referenced.

1reaction
maxkatz6commented, May 15, 2023

And it will nice to support platform suffix .cs compilation.

Unrelated to this issue.

And you already have it in the SDK - ExcludeFromCurrentConfiguration. It can be done with simple msbuild condition. Like this one - https://github.com/AvaloniaUI/Avalonia/pull/9613/files#diff-f187e1f8a2658efbbfc23efe2c18a51c40156749cf078645534481518139779eR80-R102

Note, “linux” and “browser” branches will not work…because there are no targets for these platforms. Yet?

For XAML support you would need to exclude AvaloniaXaml entries as well, I suppose.

While it would be nice to have built in, we just can’t because how .NET SDK works and what target frameworks we have on our hands.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect to platform-specific APIs | Kotlin Documentation
This works for most Kotlin declarations, such as functions, classes, interfaces, enumerations, properties, and annotations. Expect/actual ...
Read more >
Writing custom platform-specific code
Flutter uses a flexible system that allows you to call platform-specific APIs in a language that works directly with those APIs: Kotlin or...
Read more >
Summary of Chapter 9. Platform-specific API calls - Xamarin
In this article. Preprocessing in the Shared Asset Project; Parallel classes in the Shared Asset Project; DependencyService and the Portable ...
Read more >
Best API Platforms in 2023
Top 10 API Platforms · IBM API Connect · Postman · Stoplight · MuleSoft Anypoint Platform · WSO2 API Manager · Azure API...
Read more >
Platform API vs Service API | Hackney API Playbook
Platform APIs is to provide all available data for a given domain (i.e. transactions) in a generic format. Service APIs should consume the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found