Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift Basics (retired) Types Printing Results

Print does not show up on the console

When I write print("Hello"), nothing appears in the console and it displays "Hello\n" instead

2 Answers

Hi Paul,

Swift 2.0 has changed how printing is done. Instead of println which prints something and adds a new line, the print method now does the same. You can change the default behaviour and make it not generate a new line with the appendNewline: property, I think. There's also a terminator: flag that has similar behaviour. Have a look through the documentation - it'll be in there.

The output has moved, as you've seen. If you go to View | Debug Area | Show Debug Area, you will get the console output that you're expecting, rather than just the evaluation of each line of code.

I hope that helps.

Steve.

Just had a look. The appendNewline: false method of suppressing the automatic new line has been replaced with terminator: "".

Steve.

Thanks !