- Get link
- Other Apps
CFAbsoluteTimeGetCurrent() returns absolute time measured in seconds. let startTime = CFAbsoluteTimeGetCurrent() doSomeWork() let difference = CFAbsoluteTimeGetCurrent() - startTime print(“Your method took \(difference) seconds") func doSomeWork() { //Write your code here } Official documentation: https://developer.apple.com/documentation/corefoundation/1543542-cfabsolutetimegetcurrent