升级Xcode以后,在SwiftUI开发过程中,使用ForEach语句的时候,遇到一个“Non-constant range: argument must be an integer literal ”的警告。如下图
其解决方法比较简单。在之后加上id:\.self 。 至于为什么这么加没有找到原因。姑且做个记录。
ForEach(0..<count,id: \.self) { index in
VStack {
Text("Text...")
}
}
升级Xcode以后,在SwiftUI开发过程中,使用ForEach语句的时候,遇到一个“Non-constant range: argument must be an integer literal ”的警告。如下图
其解决方法比较简单。在之后加上id:\.self 。 至于为什么这么加没有找到原因。姑且做个记录。
ForEach(0..<count,id: \.self) { index in
VStack {
Text("Text...")
}
}