DEV Community

Herlandro Hermogenes
Herlandro Hermogenes

Posted on

2

U𝗽𝗱𝗮𝘁𝗲 your view at runtime on the simulator using LLDB

How to use LLDB (XCode) to change the view background color at runtime and update view UI on the simulator (for projects without SwiftUI)?
Image description

  • Set a breakpoint in the same line that you want do change/update in runtime.
  • Run the app on the simulator. When the execution is paused, type this expression on the main thread in the XCode console:

e DispatchQueue.main.async { self.view.backgroundColor = UIColor.blue }

  • Hit Enter and release the execution. You will see the background changing from green to blue on the simulator.

This is a good UI solution for UIKit projects without SwiftUI Preview

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay