WidgetKit get frame size of Widget

Hi,

In my previous post it was suggested to use MKMapSnapshotter to create Widgets containing map data.

Now I wonder how I can create the right screenshot for the rect defined by MKMapSnapshotter size according to the current Widget size. It seems that the size differs by device and by widget size.

Accepted Reply

Hello, the methods in TimelineProvider have an argument of type TimelineProviderContext. You can use TimelineProviderContext.displaySize to get the size you need.

Replies

Hello, the methods in TimelineProvider have an argument of type TimelineProviderContext. You can use TimelineProviderContext.displaySize to get the size you need.

Great thanks for your help and sorry I didn't look properly in the documentation.
Your work here is really fantastic - thank you!