Calculating the difference between two dates in seconds : I need to know how much time elapsed from the moment the app was terminated to the time the app was launched again. I guess you'd have to store the startDate by saving it in the appDelegate when appIsTerminated. Then you'd have to access that value in appDidLaunch, also in appDelegate and then calculate the difference between those times. I need the difference in seconds and I want to use the difference in my viewController. How do I do this in swift 3, Xcode 8?