點(diǎn)選的文字變成紅色
image.png
ForEach(0 ..< TITLES.count, id:\.self) { index in
Text(TITLES[index])
.foregroundColor(self.選擇號(hào) == index ? .red : nil)
.onTapGesture {
self.選擇號(hào) = index
}
}