AvaloniaUI - MVVM/ReactiveUI - compatability with standard ReactiveUI - reactiveui

Avalonia UI has an own implementation/version of ReactiveUI. How compatible is this library with the standard ReactiveUI library ?
In other words, can I create my models and viewmodels in a standard library with the nuget for the standard ReactiveUI library (not the avalonia one) and leave it up to the clients how to implement the UI/views ? If they prefer WPF, Xamarin, UNO or Maui (all possible with ReactiveUI at this moment), they can use one of these for the views. If they prefer avalonia for the views, they can use the Avalonia implementation. Is that possible ?
A second question is if the Avalonia-ReactiveUI messagebus is 100% compatible with regular ReactiveUI (for the same reason as mentioned before) ? So can I pass messages from regular/standard ReactiveUI to a AvaloniaUI-ReactiveUI implementation ?

Avalonia is using standard ReactiveUI since 0.6.0. Avalonia.ReactiveUI package just configures the required services.

Related

Is ReactiveUI.Blazor ready for use ? .. Are there any examples?

.. I'm new to ReactiveUI ..
trying to use ReactiveUI.Blazor .. in Blazor Server Side
.. it has been released but I can't see any examples in the solution
https://github.com/reactiveui/ReactiveUI/tree/master/src/ReactiveUI.Blazor
The only example I can find of Blazor with ReactiveUI
is https://github.com/Nethereum/NethereumBlazor and it's just using ReactiveUI .. not ReactiveUI.Blazor
Any one using ReactiveUI.Blazor ?
cheers in advance
Stu
ReactiveUI is never finished, but there are working samples for Blazor Server-Side (which is now released as of AspNetCore 3.1) and also working samples for Blazor Hosted and Blazor Client models in the ReactiveUI.Samples repository.
You can find the direct link here
TLDR: I had an amazing experience working with Reactive.Blazor in a WASM Blazor application and can absolutely recommend using it.
I used ReactiveUI.Blazor together with Blazorise in platform for managing offers in a more structured way to perform estimates based on the structured (meta)data of the offers.
I used the WASM version of Blazor and my experience was very good. Reactive functional programming (FRP) works well in React and Angular so it seemed like a good fit for Blazor as well.
My review:
The setup was pretty easy. I took a few notes from this arcticle and the code behind it.
I used DynamicData as well, which for me is somehow already part of the whole ReactiveUI stack. It fit very well into the whole application layout, although most of the components in Blazorise do not support the appropriate listeners for collection changes - there you need to support a bit with your code. I absolutely recommend using DynamicData as proxy/cache for your APIs though - state management has never been easier.
The easy form validation, which was a near natural fit for the Blazorise components was for me one of the major selling points - because I rely heavily on dynamic forms.
I am not too happy with the routing and IoC approaches yet. I am used to Autofac for most of my development, which I could easily use my services although for my views and viewmodels I had to rely on a service locator pattern (with Splat backed by Autofac).

Which plugin (npm) to use for localization in NativeScript?

Which plugin (npm) to use for localization in NativeScript and Angular?
nativescript-localize implements the native way of localizing iOS / Android apps.
tns plugin add nativescript-localize
If you like to find any plugins, you can simply do a search at https://market.nativescript.org/ Checkout the number downloads / recent releases to understand the popularity / stability of the plugin.
Note: At present this plugin doesn't support switching the language within your app, it always picks up the default language of the device which is more generic way of handling localization with mobile apps.
If you prefer to control the language selection within your app, you may have to go with any angular specific plugins to manage your language.
You can simply use ngx-translate for you NativeScript project. All other plugins implements native i18n, so you can't change the application language on runtime. Because they depend on the os language.
Most of the time we use English as our os language but doesn't necessarily mean our native language is English. Here you go.

What does MvvmCross do that Xamarin doesn't already?

Hi so I'm a newb at cross platform stuff and I'm trying to figure out what MvvmCross brings to the table.
From my poor understanding, Xamarin already allows for everything except UI stuff to be written in csharp. Where does MvvmCross come in?
MvvmCross brings the MVVM pattern to platforms where it was previously unavailable, like iOS and Android.
It also supports data binding in Views. This is a powerful feature that provides great separation of concerns. The View will use the ViewModels to offer proper behaviors in the application. MvvmCross even locates the ViewModels in a dedicated project so you can easily reference and reuse them in others.
This is the most important point when talking about MvvmCross. By locating the ViewModels in a Portable Class Library (PCL), you can add them as a reference to any other projects. Of course, that’s not the only interesting point of MvvmCross. There’s also a plug-in architecture, dependency injection (DI) and more.
Source: https://msdn.microsoft.com/en-us/magazine/dn759442.aspx
Xamarin already allows for everything except UI stuff to be written in
csharp.
Xamarin allows you to write UI stuff in C#.
MVVMCross (Mvx) allows you to use the MVVM pattern in cross platform development, so that you can have a shared business logic layer, ViewModel. So you are creating different Views based on the platform but binding to the same ViewModel.

How to use NSOutlineView with ReactiveUI?

I want to convert a small MonoMac application that I created so that it uses the MVVM pattern (especially to port in easily to Windows). I want to use the ReactiveUI framework. The current application uses an NSOutlineView control with a corresponding data source. As far as I could see there is no support currently for this control.
Is there a guideline how to adapt the NSOutlineView and data source so that it supports data binding as used by the ReactiveUI framework?
Unfortunately the data source support that ReactiveUI provides is iOS only and the code is quite complicated, but you can have a look at ReactiveTableViewSource and friends and try to create an equivalent for NSOutlineViewDataSource.
The general idea is, create a NSOutlineViewDataSource that can follow around a ReactiveList of ViewModels, and create Views for them as-needed.

Using HttpClient in a Xamarin core project

I am doing a project for multiple platforms where I have followed best practices and created a core project to contain all the code that is the same on all platforms.
To do the network communication I would like to use HttpClient which seems to be the recommended approach for communicating with web services going forward.
I am NOT doing a PCL but just a standard C# library to contain the core project. However it seems that there is no common implementation of HttpClient but only platform specific ones. I cannot reference and use it in my core but only in my Android and iOS projects.
I would very much prefer to have all networking code in my core project and as I see it there are two options - neither of which I like.
Make a common interface that I can use in the core project that is implemented as a wrapper on both Android and iOS.
Use another technology that is supported in the core project - I am thinking webclient or the like.
What is the recommended approach and why hasn't Xamarin made HttpClient available as a common library?
Hope someone can help,
Thanks
I recommend checking out ModernHttpClient https://github.com/paulcbetts/modernhttpclient
It is a cross-platform networking library for iOS and Android. From the project:
This library brings the latest platform-specific networking libraries
to Xamarin applications via a custom HttpClient handler. Write your
app using System.Net.Http, but drop this library in and it will go
drastically faster.
You should be able to use System.Net.Http in your core library just fine, I've done it recently.
Make sure your core library is a .Net 4.5 project. There is a setting in project options for selecting the .Net version. After checking this, all you should have to do is reference System.Net.Http.dll.
If that doesn't solve your issue, are you on Windows or Mac(Xamarin Studio)?
I'm afraid you can't use HttpClient on Mono at the moment due to licensing restrictions. There is a UserVoice suggestion that you can vote on if you like.

Resources