I am implementing timer on lock screen widget using Timer.publish and .onReceive on Text. But the timer is not firing. let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
I have a Text() in ZStack which I want to update.
I am implementing timer on lock screen widget using Timer.publish and .onReceive on Text. But the timer is not firing. let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
I have a Text() in ZStack which I want to update.
Widgets are static, your app sends an encoding of the View structs to the lock screen so none of the actions work. However, there are ways to request a refresh, see Keeping a Widget Up To Date | Apple Developer Documentation