文字列表显示 (选中状态)
2020-07-22 本文已影响0人
艾迪不是奥特曼
点选的文字变成红色
image.png
ForEach(0 ..< TITLES.count, id:\.self) { index in
Text(TITLES[index])
.foregroundColor(self.选择号 == index ? .red : nil)
.onTapGesture {
self.选择号 = index
}
}