ioswidgetkitmac-catalystioswidgets

How to provide iOS widgets to Mac Catalyst?


I have a proxy app with an iOS widget extension that works perfectly when run on a Mac when built as 'Designed for iPad'. But recently we decided to make a full 'Mac Catalyst' target for arm64+x86_64 chips.

Almost the whole app was ported without issues except widgets.

I added 'Mac Catalyst' target to the widget app extension and tried to add macOS support to it (no results). They just don't appear in WidgetDock now.

I have 2 questions:

  1. Is there a way to port iOS widgets to Mac Catalyst without pain?
  2. If not, what should be done to recreate those widgets for Mac Catalyst (same visuals etc.)?

Solution

  • Found solution myself:

    Needed to add support for 'macOS' to widget.appex -> build settings -> supported platforms (Your widgets must be pure SwiftUI without any UIKit code)

    supported platform setting

    Because Mac Catalyst is not using iOS runtime (as I understood) and can't create widget extension without this tweak.