-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS clock animations on homescreen widget #1
Comments
I saw the same, I'm building a Widget App and I would like to have the sub second hand on my clock. Did you find out? |
@liudhzhyym @mromanuk Thanks for the question. According to Apple it can't be done. Here you can find a comment made by a Systems Engineer from Apple:
Also, from the Human Interface Guidelines for Widgets:
My understanding is that the only way for third-party apps to provide such animations is to use private API. The system Clock Widget does this after all, so it might actually be possible to replicate this behaviour using some private methods that I'm not aware of. I didn't really look into it myself yet (will probably do when I have more time) but in the meantime you can see this post for a starter: |
It looks like the private method you were looking for is extension SwiftUI.View {
@available(iOS 14.0, macOS 11, *)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
public func _clockHandRotationEffect(_ period: WidgetKit._ClockHandRotationEffect.Period, in timeZone: Foundation.TimeZone, anchor: SwiftUI.UnitPoint = .center) -> some SwiftUI.View
} If you'd like to investigate it more, this code can be found in the WidgetKit framework module. As I mentioned in the post above, the whole tutorial can be found here: And here's the path to the original WidgetKit module:
Please bear in mind that this is a private method and not approved by Apple - it may stop working any time or your app might be rejected (even after initially approved). |
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.
Do you know how do they do it?
The text was updated successfully, but these errors were encountered: