无法覆盖类型countable closedRange <int>的值到期望的参数类型Rang <int>

时间:2017-07-11 09:38:07

标签: swift swift3

请帮助如何在swift3中解决此错误

 let max:Int = Int(StackMaxWidth/10)
 let min:Int = Int(StackMinWidth/10)
 let width:CGFlot = CGFlot(randomInRange(min...max)*10)

enter image description here

func randomInRange(_ range: Range<Int>) -> Int {
let count = UInt32(range.upperBound - range.lowerBound)
return  Int(arc4random_uniform(count)) + range.lowerBound

} 这是一种功能

1 个答案:

答案 0 :(得分:0)

self.StackGapMinWidth...maxGap替换为self.StackGapMinWidth..<(maxGap + 1)