OscarWyck
OscarWyck

Reputation: 2535

Swift println command does not output in console

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?

Upvotes: 3

Views: 15544

Answers (5)

Blackvenom
Blackvenom

Reputation: 687

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.

Upvotes: 2

kishorer747
kishorer747

Reputation: 820

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.

Upvotes: 1

Jorge Casariego
Jorge Casariego

Reputation: 22212

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")

Upvotes: 1

Upendar Gareri
Upendar Gareri

Reputation: 427

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.

Upvotes: 1

Cai
Cai

Reputation: 3659

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

If so, it should work.

enter image description here

Upvotes: 0

Related Questions