Show Menu

Do you have a job opening?

Submit your 30 day Job Listing for FREE

There’s very useful debugging feature in iOS simulator – Toggle slow animations, but it’s only a simulator functionality and there’s no way to have the same while debugging on device. Or is it?

Well, there’s very hidden and unobvious but still working way to achieve the same.
Hit pause while running app on device. lldb will stop at some point, most probably deep in system code, it doesn’t matter.
Type in console following command:


p [(CALayer *)[[[[UIApplication sharedApplication] windows] objectAtIndex:0] layer] setSpeed:.1f]

XCode4.5 and XCode4.6.1 usually take about couple of seconds to run such command for the first time so no worries, just wait. I’ve heard in the latest XCode update (went out yesterday) this issue was fixed, but haven’t tried it yet.
That’s all. Now all the animations – system, initiated from your code directly using any API, will be adjusted to master speed which you just modified.

To understand how it actually works you should recall that CALayer conforms to CAMediaTiming protocol and using this protocol’s methods we can control animation options of entire layer’s tree.

having issues?

We have a Questions and Answer section where you can ask your iOS Development questions to thousands of iOS Developers.

Ask Question

FREE Download!

Get your FREE Swift 2 Cheat Sheet and quick reference guide PDF download when you sign up to SwiftMonthly


Sharing is caring

If you enjoyed this tutorial, please help us and others by sharing using one of the social media buttons below.


Written by:

Hi. I’m a passionate iOS developer living in Toronto, ON. Being an expert in what I’m doing I’d like to share some expertise with others. But I don’t want to copy stuff someone already put out there in internet, so I blog mostly something I wasn’t able to find anywhere else.

Comments

comments