0

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.

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Nov 11 '22 at 13:29

1 Answers1

0

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

malhal
  • 26,330
  • 7
  • 115
  • 133