Did you know that LLDB includes an REPL?
Set a breakpoint in your Xcode project, say the method that gets run when you hit a button. In the debugger proompt, type
Then paste this in:
let v = UIView() v.frame = CGRect(x: 20, y: 20, width: 200, height: 20) v.backgroundColor = .red let window = UIApplication.shared.windows window.rootViewController?.view.addSubview(v) CATransaction.flush()
You should see that the new red view appears immediately upon
CATransaction.flush() while you are still in the debugger. It is important that you are not breaking in
application(_:, didFinishLaunchingWithOptions:) for
flush() to "load" your changes immediately.
: and hit enter to exit the REPL.