print vs NSLog

Mr.Javed Multani
1 min readOct 2, 2020

In swift we can use both print() and NSLog() functions to print something on Xcode console. But there are lot of differences in print() and NSLog() functions, such as:

1 TimeStamp: NSLog() will print timestamp along with the string we passed to it, but print() will not print timestamp.
e.g.

let array = [1, 2, 3, 4, 5]
print(array)
NSLog(array.description)

Output:

[1, 2, 3, 4, 5]
2017–05–31 13:14:38.582 ProjetName[2286:7473287] [1, 2, 3, 4, 5]

--

--

Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer