iosswiftswiftuiwidgetwidgetkit

iOS clock animations on homescreen widget


I want to add a homescreen widget to my app, just like the iOS system Clock app, the second hand keeps moving every second. I have been searching on Google and Github for a long time and have not found a suitable solution. I have seen that there are already third-party apps that can implement such desktop widgets. For example:

How do they do it?


Solution

  • Use View._clockHandRotationEffect(.secondHand, in: .current, anchor: .center)

    enter image description here