-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move data class extensions to TrackWorkout file. Setup position track…
…ing to run in background.
- Loading branch information
Showing
6 changed files
with
130 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// Intervals.swift | ||
// Trainer | ||
// | ||
// Created by Deborah Engelmeyer on 11/3/17. | ||
// Copyright © 2017 The Inquisitive Introvert. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Intervals { | ||
// Text description for intervals | ||
public override var description:String { | ||
get { | ||
var text:String = "Repeat " | ||
for object in self.phases! { | ||
if let phase = object as? Phase { | ||
text += "\(phase.description), " | ||
} | ||
} | ||
text += "\(self.repeats) times" | ||
return text | ||
} | ||
} | ||
// Expected time for an interval or NaN if based only on | ||
// distance | ||
public override var time:TimeInterval { | ||
get { | ||
duration = 0.0 | ||
for object in self.phases! { | ||
if let phase = object as? Phase { | ||
duration += phase.duration | ||
} | ||
} | ||
duration *= Double(self.repeats) | ||
return TimeInterval(duration) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters