duration
The cumulative time in seconds that an activity has been active.
Declaration
var duration: TimeInterval { get }Discussion
When you create a new activity to represent a new attempt at a task by calling the createNewActivity() method, the duration initializes to zero. After calling the start() method, it begins counting seconds. When you call the stop() method, the duration counter stops. It resumes counting (without resetting) if you make a new call to the start() method, enabling you to effectively pause an activity. However, when you create a new activity, the duration of the previous activity stops permanently and is no longer accessible to your app.