I have a published property in SwiftUI declared thus:
import SwiftUI
class UserData: ObservableObject {
@Published var showLoginButton = true
In the debugger at a breakpoint I cannot see the value of this property. I can see the value of properties that are not decorated as @Published.

What expression do I need to see the current value of a published property when debugging SwiftUI?
@Published is a property wrapper, so you see its storage. To get value just print property, so here it is
(lldb) e _showLoginButton
(Published<Bool>) $R0 = {}
(lldb) e self.showLoginButton
(Bool) $R2 = true
Make sure your source code (tests included) includes import Combine. In the Xcode debugger you can then use the print description button (icon is a circle with an 'i' in the center) to view the current value. Without the import the console will show "error: cannot find type 'Combine' in scope".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With