Using Swift REPL from LLDB

Suppose you're paused in a breakpoint, at the LLDB console. To run swift code, you need to prefix every line with e (alias for expression) or po (alias for expression --object-description --). You also need to remember to prefix every new varaible assignment with $ (otherwise it silently succeeds but seemingly does nothing), such as e let $foo = "Hello"

Typing repl (alias for expression --repl --) opens a Swift repl that lets you easily/naturally run Swift code with several benefits:

  1. No need to prefix each line with e or po
  2. No need to prefix each new variable with $
  3. Each expression result is assigned to an implicit $R123 variable

But there one huge, totally game-breaking downside: You can't access any variables from the current breakpoint context, or any of the types available in your program.

Is there a way to fix that?


I have recently tried to use the REPL for something too and I was let down.

Can anyone please clarify what is the REPL meant to do? I hoped it would be used in the same manner as Python scripts :/