muak / AiForms.Maui.SettingsView

SettingsView for .NET MAUI
MIT License
162 stars 12 forks source link

Settingsview not registered after NuGet install #31

Open spenol opened 3 months ago

spenol commented 3 months ago

Description

When Maui.SettingsView is installed via NuGet, it doesn't seem to register in the IDE - adding the reference .UseSettingsView() in MauiApp.CreateBuilder() isn't recognised, and adding xmlns:sv="clr-namespace:AiForms.Settings;assembly=SettingsView" into xaml isn't registered.

Steps to Reproduce

  1. Install Maui.SettingsView via NuGet
  2. Attempt to add .UseSettingsView() and xmln:sv reference in xaml isn't recognised.

Expected Behavior

.UseSettingsView() and xmln:sv references should be recognised once it's installed via NuGet

Actual Behavior

As above.

Platforms

Basic Information

regolas commented 3 months ago

I am receiving a similar issue at this step. I added a using AiForms.Settings; to the MauiProgram.cs file and it will recognize .UseSettingsView() It does debug under Android emulator. However, there is a global debugger error whenever using Windows machine to debug. I have not entered any other code for this package, yet. I needed to fix it like this public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp() .UseMauiCommunityToolkit();

if DEBUG

        // Bypass UseSettingsView on Windows in debug mode
            if (!OperatingSystem.IsWindows())
        {
            builder.UseSettingsView();
        }

else

            builder.UseSettingsView(true)

endif

            builder.ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
            });

if DEBUG

        builder.Logging.AddDebug();

endif

        return builder.Build();
    }
spenol commented 3 months ago

Thank you @regolas that's helpful. I also note that when adding using AiForms.Settings, it's only recognised for iOS and not Android, Windows or MacOS.

Does anyone know if/when support of wider MAUI platforms may be included? If not, I may need to move to another solution, but don't really want to as SettingsView is by far the easiest way I've found to create settings pages....

If wider platforms aren't in scope in the near future, grateful for any easy-to-use alternatives...

muak commented 3 months ago

@spenol @regolas Thank you for your report.

This issue does not occur in my environment (Mac / VS for Mac or Rider) I have installed it from nuget and it is working fine on Android. I have also released an application that uses this library.

It may be that this problem only occurs when deploying from Windows. I would appreciate it if you could let me know if you find anything else.