I have a function like below, but when I perform it , it's show "Escaping closure captures 'inout' parameter 'cani'" and i missing anything?
func duration(out:Int,h2:Int,rep:Int,cani:inout Bool){
var io = 0
var b = 0
cani = false
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { // "Escaping closure captures 'inout' parameter 'cani'" //
timer in
io += 1
b += 1
if b <= out{
text = "come in"
}else if b <= out + h2 && b > out{
text = "Hold on"
}
if io == (out + h2 ) * rep{
textcange = "End"
timer.invalidate()
cani = true
}
}
}
it's show "Escaping closure captures 'inout' parameter 'cani'"