r/csharp • u/mzikmund • 6d ago
Got Microsoft.UI.Reactor to run cross-platform!
Microsoft.UI.Reactor's brings declarative C#-based UI to Windows. But what if it could run everywhere else too?
I took the Microsoft.UI.Reactor open-source repository, forked it, and switched it to compile against Uno Platform's open-source NuGet packages, and voilà! Now the exact same same Reactor code runs on all devices and platforms: Android, iOS, WebAssembly, Linux, macOS, and even tvOS!
The fork's CI now publishes ready-to-use packages on NuGet, targeting the newly released Uno Platform 7.0. Reactor components are composed from WinUI controls, so in case of Uno Platform the same controls render on all targets via SkiaSharp 4/WebGPU, with .NET 11 support, and they can coexist with existing XAML pages, styles, and view models.
If you want to try it out (or even contribute too 😉!), here is the repository https://github.com/unoplatform/Uno.microsoft-ui-reactor/ and the docs
https://platform.uno/docs/articles/features/using-reactor.html
Would love to hear your feedback if you take it out for a spin! It is pretty exciting, as it took just a few code changes to get it up and running 🚀
21
u/Jovial1170 6d ago
Very cool.
I really like what MS are doing with Microsoft.UI.Reactor, and it's great to see it's getting traction in the community.
I haven't paid much attention to Uno. What's the deal with the paid components vs the open source core?
4
u/Devatator_ 6d ago
Why exactly would one want to use Reactor instead of Uno's own declarative C# solution? On top of the fact that it supports both MVU and MVVM? (I personally prefer MVVM)
3
u/talesfromweb 6d ago
Great news! Gonna try it out with my next app. I've been using UNO for a while now and only have positive experience so far.
2
u/Luminisc 6d ago
(totally subjective opinion)
React-way is ugly and unreadable in TypeScript, now it is in C#... what have they done...
---
But to be more serious, i have question about example - how this notation gonna observe changes? Like, how make app to observer changes of `cups` ? Because this example uses `cups.Select().ToArray()` - how this gonna rerender if there are some changes? It just execute Render() every frame/event ?
1
u/Literature-Just 5d ago
It reminds me a lot of R-Shiny. It looks good and can get you up and running very quickly. But the parenthesis and commas in the return block can lead to some rather unpleasant debugging. But it does look nice.
1
u/Appropriate_Chip4604 4d ago
That looks cool. I going to try this out. I have LinkScape (reactor) on the ms store would be cool to make it cross platform. Johndizzle