iosswiftxcodexcode8-beta3

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


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


Solution

  • 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.