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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -