-
Notifications
You must be signed in to change notification settings - Fork 554
Mac Catalyst (Early Preview)
This guide is for super-early adopters to experience using Mac Catalyst to build iOS projects for running on macOS. This is unsupported.
For release plans, refer to the .NET roadmap.
- Install this package: xamarin.ios-14.9.0.153.pkg
- OR an alternative package with fixes for Xamarin.Forms: xamarin.ios-14.9.1.10.pkg (not signed nor notarized)
- Visual Studio Code - there is no IDE or debugging support
- Terminal
You can either start with an existing project (and add to it), or start with a new project (and edit the csproj).
Existing test project: https://github.com/xamarin/xamarin-macios/tree/catalyst6/tests/common/TestProjects/MyCatalystApp
Existing Xamarin.Forms test project: https://github.com/rolfbjarne/xamarin-macios/tree/b4d80b73294b5d50fbce24801450627a6a2368d2/tests/common/TestProjects/MyCatalystFormsApp (requires the pkg with Xamarin.Forms support from above)
Create a Xamarin.iOS project, and modify the csproj like this (in a text editor):
- Change the Import at the bottom to point to:
<Import Project="$(MSBuildExtensionsPath)\Xamarin\MacCatalyst\Xamarin.MacCatalyst.CSharp.targets" />- Add a reference to Xamarin.MacCatalyst:
<Reference Include="Xamarin.MacCatalyst" />The reference to Xamarin.iOS can stay (it will be necessary if using NuGets built for Xamarin.iOS)
-
Change the
MinimumOSVersionkey in the Info.plist to beLSMinimumSystemVersioninstead.- Also change the value to
10.15
- Also change the value to
-
Make sure you're building for iPad (or a Universal app /iPad + iPhone)
-
Remove the iPhone configuration [optional]
-
Search & Replace “iPhoneSimulator” → “MacCatalyst” [optional]
If you use Xamarin.Forms, you’ll have to add any references manually, like this (for example): https://github.com/rolfbjarne/xamarin-macios/blob/b4d80b73294b5d50fbce24801450627a6a2368d2/tests/common/TestProjects/MyCatalystFormsApp/MyCatalystFormsApp.csproj#L98-L109
In most cases, you will also need to add:
<Reference Include="Xamarin.Forms.Platform">
<HintPath>$(PkgXamarin_Forms)/lib/Xamarin.iOS10/Xamarin.Forms.Platform.dll</HintPath>
</Reference> msbuild /t:restore
msbuild path/to/myproj.csproj
open ./bin/MacCatalyst/Debug/*.app
- Xamarin.MacCatalyst projects won’t work in any IDE (so no debugging).
- The API surface of Xamarin.MacCatalyst.dll is not complete (no need to file issues about missing or wrong API). In particular there’s no support for any AppKit types.
- “nuget restore” doesn’t work. Use “msbuild /r” instead