Because print
is not NSLog
. It is as simple as that.
NSLog
is a logging tool in Foundation that writes to the Apple System Log facility which appears on the console.
print(…)
is a print function in the Swift Standard Library that writes to standard out, which appears on the console in debug sessions.
You could add Date()
to your print
parameter to print the current time and date. (Or Date().description(with: Locale.current)
to get it in your local time zone.)
Or you could just use NSLog
which is available in Swift too (if you import Foundation).
NSLog
prints to the Console (and your log is visible in Console.app) butprint
in Swift doesn't do that. – Hhdprint
just prints to the Xcode console? – HhdNSLog
will print output to the console in a release build whileprint
will not. Choose wisely. – Claudette