NOTE: I know that this question is quite similar to others and I've tested all the answers but they just don't seem to work for me. That is why I'm posting this here.
My code:
var time = 10
var day = time * 86400
var week = day * 7
The error is:
Cannot use instance member 'time' within property initializer; property initializers run before 'self' is available
It points at 'time' in the day-variable.
I've tried:
lazy var day = time * 86400
But that doesn't change a lot.
var time:Double = 10
var day: [Double] {
return [(time * 1440) as Double]
}
var week: [Double] {
return [(day) * 7.0 as Double]
}
But then the error is:
Binary operator '*' cannot be applied to operands of type '[Double]' and 'Double'
Changing it to
var week: [Double] {
return [(day) * 7.0 as [Double]]
}
Doesn't work, error:
No '*' candidates produce the expected contextual result type '[Double]'
I just hope someone knows how to solve this :) Thanks!