Xcode console swallows blank lines when printing string variables

After upgrading from Xcode 14.3 to Xcode 15.2, I am observing unexpected behaviour in Xcode when printing string variables to the console.

Specifically, blank lines do not show up (they previously did, as expected, with Xcode 14.3).

Steps to reproduce:

  1. Put this multiline (Swift) string literal in some Swift file (two lines with one blank line in between)

    let test = """
    line1
    
    line3
    """
    
  2. let Xcode hit a breakpoint in the file with the string

  3. print the string value to Xcode console:

    (lldb) po test
    "line1\n\nline3"
    
  4. print the same string, cast to NSString, to Xcode console:

    (lldb) po test as NSString
    line1
    line3
    

Observed:

  • The blank line is missing in the "po test as NSString" output

Expected:

  • There should be a blank line between line1 and line3

I'm running macOS 13.6 (22G120) and Xcode 15.2 (15C500b)

It sounds like your goal here is to report a bug, in which case I recommend that you file it with Feedback Assistant. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Reported as FB13582772

Xcode console swallows blank lines when printing string variables
 
 
Q