How to access WidgetCenter from WidgetKit in Xamarin.iOS?

Viewed 546

I need to notify WidgetKit to reload my iOS 14 widget. In Swift you can do that using WidgetCenter:

WidgetCenter.shared.reloadAllTimelines()

However, WidgetKit seems to be unavailable in Xamarin.iOS.

1 Answers

WidgetKit's reloadAllTimelines is not currently available to Xamarin.iOS (it is available only via the Swift-based frameworks and technically Xamarin.iOS binds the ObjC frameworks).

It is on the Xamarin.iOS enhancement list

Currently you would need to write a Swift library and then Xamarin.iOS bind it to expose it so you can call it from .Net code.


Third-party repo/project that exposes WidgetKit's ReloadTimeLinesOfKind, ReloadAllTimeLines, & GetCurrentConfigurationsWithCompletion (see Wojciech Kulik's comment below)

Related