How can I see the messages being printed at runtime in Xcode?
For example the following line:
print("Testing")
Press ⇧⌘Y or choose View > Debug Area > Show Debug Area to show the console output (or ⇧⌘C / Activate Console). Usually, this window will open automatically when your program produces output (this is controlled by the Behaviors section of Xcode's Preferences). Save this answer. Show activity on this post.
Go to Xcode → Preferences → Debugging → On Start → "Show Console". Save this answer.
Use print statement inside SwiftUI view You need to assign print() to a variable ( var ) or a constant ( let ). Here is an example of how we can use print() in a SwiftUI view. Text("Hello, World!") 1 and 2 We don't use the returning result ( x and y ) anywhere.
Press ⇧⌘Y or choose View > Debug Area > Show Debug Area to show the console output (or ⇧⌘C / Activate Console). Usually, this window will open automatically when your program produces output (this is controlled by the Behaviors section of Xcode's Preferences).
XCode 11 + SwiftUI Users having the same issue, the answer is that you need to right-click the play button in the preview window to turn on debug preview
! Assuming that you have the debug area active
(view > debug area > activate console), as seen in:
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