If you’ve ever looked at widgets on your iPhone, you’ve probably noticed they’re largely static, save for a few first-party apps. By and large, third party developers are not supposed to be able to animate them. However, [Bryce Bostwick] found a workaround.
You might be confused as to the idea of animated widgets, but it’s quite simple. For example, think of a clock app with a widget in which the hands always display the current time, or a calendar app with an icon that shows the current date. Apple’s own apps have long been able to do this, but the functionality has mostly been locked out for third parties.
One way to get around this limitation is by using a timer feature baked into the widget functionality. The timer tool is one of the few ways that third-party apps are allowed to do animation. By running a timer with a custom font, you can display various graphical elements instead of numbers counting down to create a hacky animation that updates every second.
However, there are even more advanced techniques that can get you faster, smoother animations. [Bryce] breaks down the private techniques used to rotate the clock hands on Apple’s own widget, and how to use those tools for your own purposes. It takes some sneaky Xcode tricks and a bit of math to make it fully flexible for doing arbitrary animations, but it works surprisingly well.
Will this backdoor last ? Well, Apple is always updating and changing iOS and its associated software, so don’t expect it to work forever.
Thanks to [gnif] for the tip!
The easiest and best long-term way to get around this limitation is to dump iOS :)
Why would I? It just works.
If you need to do this sort of malarkey just to add a basic smartphone feature, I’d argue it doesn’t “just work”.
That is neat hacking, and who knows, Apple might turn a blind eye if it doesn’t cause battery life issues (since this uses their own energy-optimised darwing code, and they make money on third-party apps too). Though I wouldn’t bet on it.
People may not be aware that Apple devices have relatively small batteries, and the way they compensate is by being ruthless about how and when code runs in the background (especially when it comes to rendering always-on OLED displays). Third-party apps can use Unity to drain the battery in 2 hours, and that’s OK because the user will blame the developer and not Apple. But if you’re rendering to the home screen or doing something in the background, every microjoule reflects badly on Apple’s product, and that’s when they’ll smite you with vigor.
Yup. I initially found it heard to believe that running an animation uses that much power, but because of how heavily optimised the rest of the always on stuff is, it genuinely does. The Apple Watch stopwatch and time stop showing seconds if you stop interacting with it, to save power doing an update every 1000ms.
Updates are I think meant to be on a slow timer, or Interrupt driven for stuff more like notifications.
Can’t have a decent battery if you want your phone thin enough that folks will bend it in their pocket and drop another $1000 on a replacement every 6 months.