大佬,知道怎么支持播放GIF吗?在小组件中怎么实现啊
同问,已经有app实现了动画播放,像top widget ,dtd playlist
@Jdb156158 @chdo002
Generally widgets aren't designed to have animations (at least for now). If it changes, the relevant API will be added (like in the case of interactive widgets).
I'm aware of two ways of animating widgets:
- Private API
An example can be _clockHandRotationEffect as described in this issue.
You may have to build a library with Xcode 13, so it's available in later versions.
(There might be more hidden methods - feel free to look for yourself.)
- Custom fonts
You can create a timer that will change every second.
Text(.now, style: .timer)
In theory providing a custom font as described in this thread should allow implementing gif-style animations.
同问,已经有app实现了动画播放,像top widget ,dtd playlist
@chdo002 ,加我微 JDB118158168可以一起讨论
Added AnalogClockWidget in version 1.1.0. This widget uses an example private xcframework that may not necessarily pass Apple Review.
The tutorial how to create an xcframework with ClockHandRotationEffect can be found here.