Xcode 15.0.1 object preview shows nothing in debug mode

I use Xcode 15.0.1, Sonoma 14.1.1

I created a simple SwiftUI app following a tutorial. When I put a breakpoint to see what value sits in a variable or any other object, I cannot see anything. Just a pointer to a memory address. Build setting is Debug with no optimisation on. See screenshots bellow.

Any suggestions?

It’s hard to say whether this is correct or not because you didn’t post a link to the tutorial you’re following. However, I replicated something like this myself and the behaviour you’re seeing isn’t too off the wall. Consider this program:

class Sight {
    var name: String
    
    init(name: String) {
        self.name = name
    }
}

func main() {
    let sight = Sight(name: "Hillhead Library")
    print(sight)
}

main()

If I set the breakpoint on the print(…) line, the debugger shows very little detail for the sight value. To see the name property I have to click the disclosure chevron next to it:

And if I do a po I get nothing useful there either:

(lldb) po sight 
<Sight: 0x600000205300>

To fix that, I implemented the CustomDebugStringConvertible protocol:

extension Sight: CustomDebugStringConvertible {
    var debugDescription: String {
        "Sight(name:\(self.name))"
    }
}

With that, I get a useful result from po:

(lldb) po sight 
Sight(name:Hillhead Library)

Share and Enjoy

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

I followed Paul Hudson about SwiftData iTour tutorial.

Unfortunately my preview doesn't show anything.

Xcode 15.0.1 object preview shows nothing in debug mode
 
 
Q