Post

Replies

Boosts

Views

Activity

Reply to Widgets not displaying data when running on iOS 18
I use a specific suiteName to send the data through UserDefaults, with my own key. private func sendWeatherDataToWidget(input: CurrentDataConverted) { let widgetData: WidgetWeatherData = WidgetWeatherData(theTemp: input.currentTemp, theMax: input.dailyMaxTemp, theMin: input.dailyMinTemp, theTime: input.time, theTempUnits: input.temperatureUnits, theLocation: input.location) let tempData = try! JSONEncoder().encode(widgetData) UserDefaults(suiteName: "group.com.emkubed.Weewx-Weather")!.set(tempData,forKey: "Weewx-Weather") WidgetCenter.shared.reloadTimelines(ofKind: "com.emkubed.Weewx-Weather") logger.debug("Sent data to Widget - hopefully") }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24
Reply to Widgets not displaying data when running on iOS 18
Got Another update. Decided to rewrite the widget from scratch and I can now get data to the widget to display, only I now have another problem in that my custom fonts that I use in the widget are not being used and also the background image that I have for the whole widget is not being displayed at all.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to Widgets not displaying data when running on iOS 18
I use a specific suiteName to send the data through UserDefaults, with my own key. private func sendWeatherDataToWidget(input: CurrentDataConverted) { let widgetData: WidgetWeatherData = WidgetWeatherData(theTemp: input.currentTemp, theMax: input.dailyMaxTemp, theMin: input.dailyMinTemp, theTime: input.time, theTempUnits: input.temperatureUnits, theLocation: input.location) let tempData = try! JSONEncoder().encode(widgetData) UserDefaults(suiteName: "group.com.emkubed.Weewx-Weather")!.set(tempData,forKey: "Weewx-Weather") WidgetCenter.shared.reloadTimelines(ofKind: "com.emkubed.Weewx-Weather") logger.debug("Sent data to Widget - hopefully") }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24