I have this example:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Line where the breakpoint will be placed
view.backgroundColor = UIColor.green
}
}
I want to add breakpoint, execute the app on the simulator, and when the execution is paused, I want to update the backgroundColor
to blue
and see the background on the simulator on blue color without reset the application.
To do this follow this steps:
1 - Set a breakpoint on the line where the background color is defined (view.backgroundColor = UIColor.green
).
2 - Run the project in the simulator. The Xcode will pause the app execution when the breakpoint is hit.
3 - In the LLDB console (XCode), execute the following command:
e DispatchQueue.main.async { self.view.backgroundColor = UIColor.blue }
4 - Release the app's execution by pressing the "Continue" button in Xcode.
If you want more details about this solution, you can go on my published articles on Hackernoon or Medium.