使用定时器时,出现了一个警告,Variable 'timer' was written to, but never read,代码如下
var timer : Timer
timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true, block: { (bool) in })
解决方法,没有用到“timer”变量,去掉timer的定义即可
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true, block: { (bool) in })