Plugin.Maui.Workarounds.MacCatalyst 0.0.2

dotnet add package Plugin.Maui.Workarounds.MacCatalyst --version 0.0.2
                    
NuGet\Install-Package Plugin.Maui.Workarounds.MacCatalyst -Version 0.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Maui.Workarounds.MacCatalyst" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plugin.Maui.Workarounds.MacCatalyst" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Plugin.Maui.Workarounds.MacCatalyst" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plugin.Maui.Workarounds.MacCatalyst --version 0.0.2
                    
#r "nuget: Plugin.Maui.Workarounds.MacCatalyst, 0.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Plugin.Maui.Workarounds.MacCatalyst@0.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plugin.Maui.Workarounds.MacCatalyst&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Plugin.Maui.Workarounds.MacCatalyst&version=0.0.2
                    
Install as a Cake Tool

Plugin.Maui.Workarounds.MacCatalyst

Plugin.Maui.Workarounds.MacCatalyst provides the ability to do this amazing thing in your .NET MAUI application.

Install Plugin

NuGet

Install with the dotnet CLI: dotnet add package Plugin.Maui.Workarounds.MacCatalyst, or through the NuGet Package Manager in Visual Studio.

Workarounds

Disable Mac Catalyst scaling

Mac Catalyst (and therefore MAUI) uses the "iPad idiom" by default, which scales down to 77% on macOS. This reduce detail and causes performance issues for Metal views etc.

https://developer.apple.com/design/human-interface-guidelines/mac-catalyst#Choose-an-idiom

Unfortunately, UIPickerView and some other controls are not available when using the "Mac idiom" which means that the MAUI Picker control cannot be used.

A workaround is provided to swizzle some of the private methods to disable Mac Catalyst's scaling while still using the "iPad idiom". It is unclear whether this might constiture private API usage and therefore make the app ineligible for App Store distrubution. To that end the developer must determine the suitability of this package for their use and assumes all the risk - no warranty of any kind is provided.

Upstream issue: https://github.com/dotnet/maui/issues/10622

Handler for focusable Buttons to support keyboard navigation

UIButton cannot become focused by default, and the constructor that MAUI uses for UIButton does not support sub-classing. This complicates supporting keyboard navigation on macOS, which may be required for EAA compliance.

A workaround is provided via a MAUI handler that allows UIButtons to become focused.

NSLog redirection to the debug console

The macios bindings have calls to NSLog for warning and debug messages. However, NSLog writes to stderr and so does not appear on the debug console (when debugging with VS Code for instance).

A workaround is provided to redirect stderr to the debug console if desired.

Example usage

A sample app is provided in the source repository.

using Plugin.Maui.Workarounds.MacCatalyst;

public class Program
{
    // This is the main entry point of the application.
    static void Main(string[] args)
    {
        Workarounds.RedirectNSLogToDebugConsole();

        Workarounds.OverrideCatalystScaleFactor();

        // if you want to use a different Application Delegate class from "AppDelegate"
        // you can specify it here.
        UIApplication.Main(args, null, typeof(AppDelegate));
    }
}
public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .UseFocusableButtonHandler()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
            });

        builder.Services.AddTransient<MainPage>();

        return builder.Build();
    }
}

License

This project is licensed under the MIT License.

Acknowledgements

Thanks to @jfversluis for the template project and @JunyuKuang for the Swift implementation of the scale factor override. Special thanks to @rolfbjarne for his invaluable efforts on the macios project.

Product Compatible and additional computed target framework versions.
.NET net9.0-maccatalyst18.0 is compatible.  net10.0-maccatalyst was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.2 40 9/8/2025
0.0.1-experimental.1 118 8/21/2025