I am trying to code times for weightlifting. There are four phases to a repetition:
Eccentric (Time spent lowering the weight) Bottom (Time spent at the bottom of the lift) Concentric (Time spent lifting the weight) Top (Time spent a the top of the lift)
It will be formatted like this: 1030
so in that example, a person would take 1 second lowering the weight, then immediately lift the weight taking three seconds, reach the end of the movement and stop to complete one repetition.
class rep {
var eccentric:Float // time spent lowering the weight
var bottom:Float // time spent at the bottom of the repetition.
var concentric:Float // time spent raising the weight.
var top:Float // time spent at the top of the repetition.
var notation:String
init(timeDown:Float, timeBottom:Float, timeUp:Float, timeTop:Float) {
eccentric = timeDown
bottom = timeBottom
concentric = timeUp
top = timeTop
notation = "\(eccentric),\(bottom),\(concentric),\(top)"
}
func displayNotation() -> String{
print(notation)
return notation
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let repetition = rep(timeDown: 1,timeBottom: 0,timeUp: 3,timeTop: 0)
repetition.displayNotation()
}
this outputs 1.0,0.0,3.0,0.0
What I want to do is have an additional character "X" to indicate "as fast as possible." I am thinking that I would need to create a new type for this? So I want to be able to accept a float or that particular character... totally baffled as to how to go about this.
Thanks for any response