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
<PackageReference Include="Plugin.Maui.Workarounds.MacCatalyst" Version="0.0.2" />
<PackageVersion Include="Plugin.Maui.Workarounds.MacCatalyst" Version="0.0.2" />
<PackageReference Include="Plugin.Maui.Workarounds.MacCatalyst" />
paket add Plugin.Maui.Workarounds.MacCatalyst --version 0.0.2
#r "nuget: Plugin.Maui.Workarounds.MacCatalyst, 0.0.2"
#:package Plugin.Maui.Workarounds.MacCatalyst@0.0.2
#addin nuget:?package=Plugin.Maui.Workarounds.MacCatalyst&version=0.0.2
#tool nuget:?package=Plugin.Maui.Workarounds.MacCatalyst&version=0.0.2
Plugin.Maui.Workarounds.MacCatalyst
Plugin.Maui.Workarounds.MacCatalyst
provides the ability to do this amazing thing in your .NET MAUI application.
Install Plugin
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 UIButton
s 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0-maccatalyst18.0 is compatible. net10.0-maccatalyst was computed. |
-
net9.0-maccatalyst18.0
- Microsoft.Maui.Controls (>= 9.0.82)
- Plugin.Maui.Workarounds.MacCatalyst.Binding (>= 0.0.2)
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 |