'Toggle slow animation while debugging with iOS Device
I'm using xCode 4.3.1 and I need to use the option that the iOS Simulator has => Debug -> Toggle Slow Animation but while debugging with the iOS Device.
Is it possible?
Solution 1:[1]
In Swift 3:
UIApplication.shared.windows.first?.layer.speed = 0.1
Or, if you're anywhere in your AppDelegate and you only use one window, you can do this:
window?.layer.speed = 0.1
Solution 2:[2]
For Swift Apps:
Halt your code with a breakpoint and enter the following lldb command:
(lldb) p UIApplication.shared.windows.first?.layer.speed = 0.1
Alternatively you can obviously also change the speed somewhere in you code. For example with an #if preprocessor macro at application launch
func application(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
...
#if DEBUG
application.windows.first?.layer.speed = 0.1
#endif
Don't forget to set the DEBUG symbol in the "Swift Compiler - Custom Flags" section, "Other Swift Flags" line. You add the DEBUG symbol with a -DDEBUG entry.
Solution 3:[3]
Swift 5, add this line in AppDelegate or SceneDelegate class, that's depending on your base architecture :
// create and assign window object if not exist. ?
self.window = UIWindow(frame: UIScreen.main.bounds)
// starts slow motion ?
window?.layer.speed = 0.05
Solution 4:[4]
If you want to slow down the app only in one view controller, you can configure a breakpoint to continue execution after executing the command.
You set this breakpoint in viewDidAppear.
Then you can set another "non-stoppable" breakpoint to reverse the speed to 1X.
You set this other breakpoint in viewDidDisappear.
Very simple. Can be kept in your breakpoint list deactivated and easily reused when needed.
Solution 5:[5]
In Objective-c works pretty good
self.window.layer.speed = .1f;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JAL |
| Solution 2 | theguy |
| Solution 3 | |
| Solution 4 | Mikael |
| Solution 5 | Marcos Debastiani |
