Nate writes: “I can’t figure out how to show console output/print in the Swift Playgrounds app for iOS.”
All print output appears in the “sidebar” to the right of the code as little pop-ups:
Embed the viewer by tapping “Add viewer” so you don’t have to keep popping up the quick view.
The hint box shown (for example “123”, or “?”, or “abc”, etc) depends on the type of item produced. The tiny cube represents an class instance.
Like desktop playgrounds, you can view a single value at a time or tap the embedded display to select other views like List view:
Compilation errors appear in-line for main playground code:
Sources-based errors (which you cannot yet fix in the app) are shown as popups. When these issues occur, debug back on your Mac before trying again on iOS.
It’s important to remember that the iOS Playgrounds app almost never is running the same version of Swift as you are on the desktop and won’t be until both Swift 3 and iOS 10 go gold.
Want to learn more about iOS Playgrounds? Read Playground Secrets and Power Tips.