widgetkit

How to refresh multiple timers in widget iOS14?

自古美人都是妖i 提交于 2021-02-19 04:19:31
问题 I'm currently developing an application using SwiftUI and trying to make a widget iOS 14 users can check a list of timers. This Widget has multiple Text(Data(),style: .timer) to show some date data as timer. and when the rest of the value for the timer is over, I want to show it like this 00:00 . So I implemented some way in getTimeline function referring to this article SwiftUI iOS 14 Widget CountDown But I don't know how can I do it the same way for multiple timers... In the case of my code

How to refresh multiple timers in widget iOS14?

我是研究僧i 提交于 2021-02-19 04:18:40
问题 I'm currently developing an application using SwiftUI and trying to make a widget iOS 14 users can check a list of timers. This Widget has multiple Text(Data(),style: .timer) to show some date data as timer. and when the rest of the value for the timer is over, I want to show it like this 00:00 . So I implemented some way in getTimeline function referring to this article SwiftUI iOS 14 Widget CountDown But I don't know how can I do it the same way for multiple timers... In the case of my code

How to change view on midnight in WidgetKit, SwiftUI?

白昼怎懂夜的黑 提交于 2021-02-15 04:58:30
问题 I have a code: struct ContentView: View { let entry: LessonWidgetEntry private static let url: URL = URL(string: "widgetUrl")! var body: some View { VStack { switch entry.state { case .none: ProgramNotStartedView() case .currentLesson(let lesson): LessonView(lesson: lesson, imageName: entry.program?.imageName) case .lessonCompleted(let lesson): LessonCompletedView(lesson: lesson) case .programCompleted: ProgramCompletedView() } }.widgetURL(ContentView.url) } } At midnight LessonCompletedView

iOS Add Button to Widget Extension

大兔子大兔子 提交于 2021-02-11 04:31:27
问题 I am currently designing a widget for my app and basically, the widget should consist of three buttons. So far, I didn't find any tutorial on how to add buttons to an iOS Widget Extension. I see that e.g. Google Maps uses buttons in their widgets. How can this be done? 回答1: If you want to have three buttons in your widget, then you will need to use the medium or large widget style. This will allow you to use Link controls for each button. The small widget style only allows you to set the

iOS Add Button to Widget Extension

混江龙づ霸主 提交于 2021-02-11 04:30:13
问题 I am currently designing a widget for my app and basically, the widget should consist of three buttons. So far, I didn't find any tutorial on how to add buttons to an iOS Widget Extension. I see that e.g. Google Maps uses buttons in their widgets. How can this be done? 回答1: If you want to have three buttons in your widget, then you will need to use the medium or large widget style. This will allow you to use Link controls for each button. The small widget style only allows you to set the

SwiftUI WidgetKit: How to anchor views to the top

筅森魡賤 提交于 2021-02-07 10:00:22
问题 I am attempting to layout a tableView using SwiftUI and WidgetKit and would like to achieve a similar result of that as the Apple's Notes widget. My current implementation succeeds in laying out the view in the .systemLarge widget, but not in the .systemMedium widget. I would like to pin the view to the top of the widget, such that the header of "FAVOURITES" is visible in the .systemMedium . struct PlacesWidgetEntryView : View { var entry: Provider.Entry let places = [ Place(name: "Place 1",

How to reset intent extension configurations in WidgetKit

╄→гoц情女王★ 提交于 2021-02-06 10:21:05
问题 I have an application where a user can login. If a user is logged in, then I display a placeholder for my widget and it's configurable through an intent extension. The configuration has two options: the first option depends on the username of the user currently logged in. the second option depends on the value of the first option. This works fine for 1 user, however, if the user logs out, then logs in with a different account, the old selected options are still selected when they try to

How to reset intent extension configurations in WidgetKit

旧街凉风 提交于 2021-02-06 10:18:08
问题 I have an application where a user can login. If a user is logged in, then I display a placeholder for my widget and it's configurable through an intent extension. The configuration has two options: the first option depends on the username of the user currently logged in. the second option depends on the value of the first option. This works fine for 1 user, however, if the user logs out, then logs in with a different account, the old selected options are still selected when they try to

How to prevent iOS 14 Widget opening app and react to callback

时光毁灭记忆、已成空白 提交于 2021-02-04 07:38:25
问题 So, I already read several blogs, posts, and Apple's own Human Interface Guidelines that iOS 14 Widgets are NOT interactive, BUT: It's possible to pass a short link to the app when pressing on a target. Apple on its own says: "Small Widgets got one single tap target, Medium and Large Widgets got multiple tap targets". OK! Now when you tap on these Targets the app is opening and the Widget is passing that short link to the App. BUT, now my question, where Google says Idk: Can I

Setting the TimelineProvider refresh interval for Widget

血红的双手。 提交于 2021-01-15 19:11:50
问题 Right now my Widget makes about 1 request per second. I want to change it to 1 request in 1 hour. I get some errors on the line with let timeline = ... like Value of optional type 'Date?' must be unwrapped to a value of type 'Date' and some more. Any suggestions what could be wrong: struct Provider: IntentTimelineProvider { let networkManager = NetworkManager() func placeholder(in context: Context) -> SimpleEntry { SimpleEntry(date: Date(), configuration: ConfigurationIntent(), clubname: