Our widget extension appearance, is dependent on the main app content.
The only way for us to keep the widget(s) up-to-date, is to perform the following during app inactive.
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func sceneDidEnterBackground(_ scene: UIScene) {
// Refresh home widgets.
WidgetCenter.shared.reloadAllTimelines()
This is always called regardless whether there is widget being placed. I was wondering, is this consider a good practice?
I do not wish to perform unnecessary operation, which will drain up user battery.