iosswiftuimetalkit

Cannot show MetalKit view inside iOS 17 widget


I've created a simple view with MetalKit which renders a simple triangle and works just fine in both XCode preview and iPhone Simulator w/ iOS 17.2.

However when I try to use this View in my Widget I'm getting this error and see no preview in XCode and simulator:

The body of the Widget entries' view contains the following unsupported types: PlatformViewRepresentableAdaptor<ContentView>, PlatformViewRepresentableAdaptor<ContentView>

I'm really new to iOS development in general. Is it possible to use MetalKit-based views in iOS 17 widgets to create rich animations and effects?

Edit: Thank you for pointing out that iOS is very restrictive when it comes to widget updates. However as I can tell this is not exactly the case for Standby mode when there's nothing else but max 2 widgets on screen. There are some 3rd party standby widgets with continuous, rich and smooth 60fps animations. For example: https://youtu.be/91mppDQHspE?t=38


Solution

  • MetalKit is not allowed in iOS widgets.