swift - Extra Argument 'duration' in call -
my project complaining there "extra argument 'duration' in call". here occurring
required init(coder adecoder: nscoder) { workout = workout(title: "luke's workout plan", exerciseperiods: [ exerciseperiod(duration: 5, intensity: .high), //error exerciseperiod(duration: 1, intensity: .low), //error exerciseperiod(duration: 5, intensity: .high), //error exerciseperiod(duration: 1, intensity: .low) //error ] ) super.init(coder: adecoder) }
these variables defined here:
struct exerciseperiod: printable { let duration: nstimeinterval = 0 let intensity: intensity = .high // todo: make exerciseperiod loggable var description: string { return "\(intensity.rawvalue) \(duration) seconds" } }
what going wrong here?
you assigning values duration
, intensity
in definition of exerciseperiod
structure. let
lets assign value once, can't assign value in constructor. fix this, either define duration
, intensity
var
or remove default values duration
, intensity
.
Comments
Post a Comment