We often required to calculate how much time xcode required for execute certain chunk of code. Fortunately there is a workaround which might be used is `CFAbsoluteTimeGetCurrent()`Here i have used Big O(n^2) Time complexity you can change values & test it over xcode.
let startTime = CFAbsoluteTimeGetCurrent()
// run your work
func tempFunction(_ s: String) -> String {
for _ in 0..<999 {
for _ in 0..<9999 {}
}
return "Got it"
}
print(tempFunction("123"))
let diffrence = CFAbsoluteTimeGetCurrent() - startTime
print("It required \(diffrence) seconds") // 4.7849119901657104