hfossli hfossli - 1 month ago 7
iOS Question

Detect if slow animations is on / off in iOS Simulator in code

I want to programatically detect if slow animations is on or off in simulator.

Something like this would be handy.

IPHONE_SIMULATOR_SLOW_ANIMATIONS_ENABLED()


This is for development purposes only.

Answer

Fortunately it's easy:

float UIAnimationDragCoefficient(void);

static inline BOOL slowAnimationsEnabled()
{
#if TARGET_IPHONE_SIMULATOR
    return UIAnimationDragCoefficient() != 1;
#else
    return NO;
#endif
}