# Debugging in SwiftUI

{% tabs %}
{% tab title="💈範例" %}
```swift
// let/var statements in ViewBuilder
struct ContentView: View {
    var body: some View {
        let _ = print("Update body")     // ⭐️ 
        Text("Hello, World!")
    }
}
```
{% endtab %}

{% tab title="📗 參考" %}
* Sarunw ⟩ [How to do print debugging in SwiftUI](https://sarunw.com/posts/how-to-do-print-debugging-in-swiftui/)
{% endtab %}

{% tab title="🗣 討論" %}
* [How to print() to Xcode console in SwiftUI?](https://stackoverflow.com/a/63182458/5409815)
* [Xcode 13: no more SwiftUI debug preview to see print output in console?](https://www.reddit.com/r/Xcode/comments/nxql4w/xcode_13_no_more_swiftui_debug_preview_to_see/)
* [debug previews has been removed](https://developer.apple.com/forums/thread/683773)
{% endtab %}
{% endtabs %}
