wwdc20-10028

Discuss WWDC20 Session 10028 - Meet WidgetKit

Posts under wwdc20-10028 tag

41 results found
Post marked as solved
226 Views

WidgetCenter causing app to crash went built to iOS 13.X

I have this block of code in my project and whenever I build to a < iOS 14.0 it crashes causing the error below if #available(iOS 14.0, *) { if shouldAlertWidgetCenter { WidgetCenter.shared.reloadAllTimelines() } } If I comment out the one line WidgetCenter.shared.reloadAllTimelines() Then it runs fine even though it is in the #available check and shouldn't make any difference. I tried putting the import inside of the canImport block and still crashes unless that line is commented out #if canImport(WidgetKit) import WidgetKit #endif I'm drawing a blank at what I'm doing wrong. Thanks a lot if anyone has any ideas Crash Log: dyld: Library not loaded: /System/Library/Frameworks/WidgetKit.framework/WidgetKit Referenced from: /private/var/containers/Bundle/Application/60E4FB21-B28D-4E44-8972-0370BEB6DAE8/_.app/__ Reason: image not found dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib (lldb) 
Asked
Last updated .
Post marked as unsolved
1.1k Views

WidgetKit: Get size of the widget for placeholder view

Hey, I need to know the size of the widget in advance in order to create a proper UI for my widget. This works great by using the displaySize property provided by the TimelineProviderContext. However so far I did not find any way to get the widget size for my placeholder view. Since I don't have a provider, I have no TimelineProviderContext and thus no displaySize. Is there any way to know the widget size in the placeholder? Here is a code snippet where I would need to pass the widget size to the PlaceholderView view: struct MyWidget: Widget { public var body: some WidgetConfiguration { StaticConfiguration(kind: myWidgetKind, provider: Provider(), placeholder: PlaceholderView()) { entry in WidgetEntryView(entry) } .configurationDisplayName("Display Name") .description("Description") .supportedFamilies([.systemSmall, .systemMedium]) } } Thanks in advance!
Asked
by Timac.
Last updated .
Post marked as unsolved
135 Views

WidgetKit opens iOS app, but the NSUserActivity doesn't contain the url that opened the app.

Anyone integrated #WidgetKit open actions with a Swift app? NSUserActivity doesn't contain the url? Info I have a Swift app with the AppDelegate as the main entry point (not a scene-based app). Has someone faced this issue? Thanks, P
Asked
by imperium.
Last updated .
Post marked as unsolved
104 Views

Can I add a widget only for campaign information

I wonder if we can add a widget that only display upcoming campaign information or some advertisements. I've checked the HIG but it didn't say anything about that.
Asked
by Suin.
Last updated .
Post marked as unsolved
302 Views

How does the Shortcuts Widget conform to "Widgets are not mini-apps"?

In ( https://developer.apple.com/videos/play/wwdc2020/10028/ ) it says "Widgets are not mini-apps" and "Rather than mini-apps filled with many little buttons". It also talks a lot about widgets being "glanceable". However, the Shortcuts Widget doesn't conform to this same advice. It has a lot of buttons you can tap to execute a shortcut. As a user I find the Shortcuts Widget extremely helpful. But I'm curious from a developer perspective why Apple seems to be setting a double standard in terms of the advice they give vs their own software. For some more concrete questions: How does the Shortcuts Widget (which is basically a bunch of buttons to execute shortcuts) conform to the advice given in that session about being "glanceable"? If it doesn't conform to that advice, why does it not? Is there something else developers should consider or think about here? Is the ability to have actionable buttons (like in the Shortcuts Widget) limited to Apple use only and hidden inside of a Private Framework? Or are 3rd party developers allowed to create experiences with buttons in their widget that can execute a given task?
Asked
Last updated .
Post marked as unsolved
123 Views

Migrating away from NotificationCenter widgets

Hi, Consider an app that has been shipping with a NotificationCenter widget for some time. Now with iOS 14, we want to replace that with a WidgetKit widget. But since we still support iOS 13, we have to ship with both NotificationCenter and WidgetKit widgets, otherwise our iOS 13 users will lose functionality. Would it be possible to somehow suppress the NotificationCenter widget on iOS 14, so that users that have upgraded don't get confused by the existence of both? Thank you in advance.
Asked
Last updated .
Post marked as unsolved
71 Views

Widget not displayed on Home Screen

Hi, I'm working with WidgetKit and I have a very weird issue. I've added a WidgetExtension Target to my existing project, then without any modification of the widget view,I cannot see it on the home screen when running the extension scheme. I've created a new project from Xcode 11.5 then migrated to 12.0 to add the extension, and, a newly created project from Xcode 12.0 with an added extension after, and, both are working ... What it could means ? PBXProj corrupted ? Runtime Errors on the Container App ? Misconfiguration of the Widget ? Any helps would be appreciated =)
Asked
Last updated .
Post marked as solved
450 Views

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.
Asked
by arno_app.
Last updated .
Post marked as solved
264 Views

WidgetKit and Authentication

Hi, How do I authenticate a user in a widget, indirectly? Per Human Guidelines - https://developer.apple.com/design/human-interface-guidelines/ios/system-capabilities/widgets' : Let people know when authentication adds value Once the user has logged in using the app, how do I pass the logged-in/authenticated info the widget? Thanks, hoan
Asked
Last updated .
Post marked as solved
158 Views

Best Practice for Widget Gallery Preview

Say I have a widget that requires user authentication to display relevant information, and the moment user is picking my widget in the Widget Gallery the authentication is not yet established. In this case, what's the recommendation on widget UI. Should the widget show the placeholder UI, or a UI urging user to login, or a UI using sample data?
Asked
Last updated .
Post marked as Apple Recommended
301 Views

Prioritising your widget for repeat information

It says that the widget priority is base on the value you give for this widget message compared to previous ones you have sent. So how do you ensure that this works for things like an upcoming flight. If we send the same priority as for the previous upcoming flight does that mean iOS gives it a lesser value this time and we need to keep sending an exponentially increased value?
Asked
by goaliejd.
Last updated .
Post marked as unsolved
92 Views

WIDGET KIT

Hey, i am trying to develop a widget for the new ios 14 and ipad os 14 so i require an extension in the xcode beta 12, pls help me out how to get a widget extensions. Hoping to get a reply and answer soon. thanking you DB
Asked
Last updated .
Post marked as unsolved
146 Views

Widget with timeline close to realtime

Hi, I have an app to display a realtime train arrivals. Users usually set their morning and evening stations for commutes and the app knows what info to display. A couple years ago I've added a widget and now pretty significant amount of my users just swipe right on the home screen to check their commute schedule. A typical user would check schedule around same time, may be about 1h window in the morning and 1h window in the evening. But even updating once in 3 minutes my be not enough. Update is a single and relatively small HTTP request. I can make it even a few times smaller to optimise for widget. I'm trying to find a solution so my users can still have a valuable information displayed in the widget, but from the session about new widgets and even after lab advice (was really good btw) - I struggle to find a solution at leas as good as the current one, Im not even trying to improve my users experience. Do you have any suggestion guys? PS: Current widget has 3 buttons which are useful, but I understand there is no way to have that. PPS: It will be really useful for developers who have apps with widgets and in a similar situation as me (eg. widget show real time info or based on user interaction) to know what is EOF for "old" widgets. Thanks.
Asked
Last updated .
Post marked as Apple Recommended
210 Views

Upload build with Widget extension for internal TestFlight

I've created a widget for my app and when I try to upload it to be distributed in TestFlight to my internal testers Xcode doesn't allow this operation. ERROR ITMS-90349: "Invalid Info.plist value. The value for NSExtensionPointIdentifier 'com.apple.widgetkit-extension' is invalid in the Info.plist..."
Asked
by Rubenfern.
Last updated .