xamarin-macios
xamarin-macios copied to clipboard
[Xcode 12] WidgetKit reloadTimelines API is Swift only but really needs to be callable from C# host app
As noted here the WidgetKit APIs are Swift only, which will make reloadTimelines not bindable without special measures.
This will make interacting with Widgets written in Swift extra painful, as you won't be able to request data reloads.
One approach that Rolf came up with off the top of his head to consider is:
- Build one swift file that exposes the API to C
- Embed it in libxamarin
- Create a managed API that p/invokes into it.
Extending our build to build swift on all platforms may be a tad tricky, but doable.
+1 missing reloadTimelines will make new widgets implementation really annoying.
See https://stackoverflow.com/questions/64185669/how-to-access-widgetcenter-from-widgetkit-in-xamarin-ios for work arounds.
@t9mike I'm not sure if you noticed but this question on StackOverflow was created by me 😂 Btw. I've already implemented and published new version with widgets (and Apple Watch app manually added to xcarchive) ;) Here is the result: https://wojciechkulik.pl/smog-polska
Oh I know! But just in case someone stumbles upon this issue but not the SO question. Thanks so much for your paving the way. Your app looks slick!
I have finally got to the point with my project that I have completed porting my core engine to Swift, created widgets, and new Apple Watch app (dumping old C# version).
no updates here? Any plans to support that?
This is still very much needed, thanks!
Any updates ? Still very needed, thanks!
While not a full solution to the general problem, the prototype in https://github.com/xamarin/xamarin-macios/issues/15315 can solve this specific problem, and I have a full sample which uses it.
Check it out!