Recommended way to initialize Akavache with RxAppBuilder vs CreateSplatBuilder? #4209
-
|
Hi 👋 I’m updating an app to use the newer The ReactiveUI docs show this style of initialization: IAppInstance appInstance = RxAppBuilder.CreateReactiveUIBuilder()
.WithMaui()
.WithAkavacheCacheDatabase<SystemJsonSerializer>(builder =>
builder.WithApplicationName("MyApp")
.WithSqliteProvider()
.WithSqliteDefaults())
.Build();However, the Akavache documentation still shows the older AppBuilder.CreateSplatBuilder()
.WithAkavacheCacheDatabase<SystemJsonSerializer>(builder =>
builder.WithApplicationName("MyApp")
.WithSqliteProvider()
.WithSqliteDefaults());My questions are:
Thanks in advance for any guidance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi there is an extension method currently missing that will assist with this. public static IReactiveUIBuilder UsingSplatBuilder(this IReactiveUIBuilder reactiveUIBuilder, Action<IAppBuilder>? appBuilder)
{
appBuilder?.Invoke(reactiveUIBuilder);
return reactiveUIBuilder;
}In addition to this there will be a UseReactiveUI extension for Maui which will then allow the following public static class MauiProgram
{
/// <summary>
/// Creates the maui application.
/// </summary>
/// <returns>A <see cref="MauiApp"/>.</returns>
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseReactiveUI(reactiveUIBuilder =>
{
reactiveUIBuilder
.WithMaui()
.UsingSplatBuilder(splatBuilder =>
{
splatBuilder.WithAkavacheCacheDatabase<SystemJsonSerializer>(
builder =>
{
builder
.WithSqliteProvider()
.WithSqliteDefaults();
},
"ReactiveUI.Builder.MauiApp");
})
.BuildApp();
})
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
#if DEBUG
builder.Logging.AddDebug();
#endif
return builder.Build();
}
}Thank you for raising this missing element. |
Beta Was this translation helpful? Give feedback.
Hi there is an extension method currently missing that will assist with this.
It will be added in the upcoming release
In addition to this there will be a UseReactiveUI extension for Maui which will then allow the following