Why is print() text displaying in the middle of the console instead of the end?

167 Views Asked by At

In an instructional video I recently watched, entering print() in viewDidLoad() caused the print() text to appear at the end of the text displaying in the console. But when I run the same code, the text appears in the middle of the console (as in, additional text following the body of the print() text displays in the console--see screenshot for example). Here is the code I am referring to:

override fun viewDidLoad() {
    super.viewDidLoad()

    print("Hello World!")

}

screenshot of print() command displaying in the middle of the console instead of the end

3

There are 3 best solutions below

1
On BEST ANSWER

They are likely using a different Xcode version. Xcode 8 is still in beta and they are printing a lot of different things into the console (especially if you have network requests). The runtime is hitting your print statement before printing some of these other statements.

0
On

Bug in Xcode 8: it will print stuff automatically in viewDidLoad, viewDidAppear, etc. You are printing your code in view did load, and Xcode will print logs after view did load, that is why it's in the middle.

5
On

If you're talking about the console being on the right side: see the two squared icons with a bar inside, highlighted in blue, in the lower right part of Xcode's window? Click on the left one: it will hide the properties panel and expand the console at full width.

If you're talking about the fact that "Hello World!" is in the middle of other text, that's because this other text is debug information that appeared at the same time as your print statement.