3

Using a playground file in Xcode 6 beta, I am trying to get an output in the console for the println command. I have written println("test"), opened the Assistant Editor (View\Assistant Editor\Show Assistant Editor) and see that little window named "Console output", but still I get nothing. I have also tried to close and restart Xcode.

What am I doing wrong?

OscarWyck
  • 2,515
  • 5
  • 21
  • 26

5 Answers5

2

In recent Versions of Xcode, like Beta 6, the println() result will be displayed in the sidebar on the right.

No need for Assistant Editor anymore.

But you need to install new Beta Versions manually.

Blackvenom
  • 667
  • 6
  • 13
1

1) Close the Assistant Editor

2) Quit Xcode

3) Reopen the playground file

4) Open Assistant Editor (Command+Option+Enter or View/Assistant Editor/Show Assistant Editor)

Now it should show the logs.

Upendar Gareri
  • 427
  • 1
  • 4
  • 14
  • okay... just reassuring to whether you closed the assistant editor before quitting xcod, because the log will not reflect if you quit the xcode without closing the assistant editor. I hope you did that 2-3 times. Worked in my case !!! – Upendar Gareri Jul 08 '14 at 07:35
1

If you're using Swift 2, you can only use print() to write something to the output.

Apple has combined both println() and print() functions into one.

Here is an example to print on a single line (use the optional appendNewLine: argument):

print("Hello new Print with new line", appendNewline: false)

Otherwise print defaults to adding a carriage return at the end of each line.

print("Hello new Print with new line")
Jorge Casariego
  • 21,948
  • 6
  • 90
  • 97
1

For others who face the issue, they might have closed the area where messages are shown.

If you are using print() ( from Swift 2.0 ) to print and see debug messages, do this.

Click on View on top, Go To Debug Area and click Activate Console.

This will open the area where debug messages are printed.

kishorer747
  • 810
  • 1
  • 10
  • 24
0

Which version are you using? Xcode 6 beta 2? OS X 10.10?

If so, it should work.

enter image description here

Cai
  • 3,609
  • 2
  • 19
  • 39
  • I have exactly what you have written. Do not run Yosemite though, but should not make any difference. Or should it? – OscarWyck Jun 25 '14 at 15:26
  • Xcode 6 crashes all the time on my 10.9.3, so I end up install 10.10 on one of my Macs as a develop machine for Swift. It's hard to say there's a difference or not, only Apple and God knows. And I noticed that, even with the same 10.9 SDK, the one compiled on 10.10 won't run on 10.9, but when you do it on 10.9, it works. – Cai Jun 25 '14 at 15:30