I have the following code in a ContentView.swift
file:
struct ContentView: View {
@State private var selectedSpeed: Int = 1
var body: some View {
Text("Hello World")
}
}
I have simplified it for the sake of readability. I know that selectedSpeed
is not being used.
In the line where selectedSpeed
is declared, I'm getting the following error: Struct 'State' cannot be used as an attribute
Interestingly, pasting the exact same code in a Playground builds successfully. I'm on Xcode 12.1. I've tried the combo of nuking derived data and re-opening Xcode but the error persists. Any ideas what is wrong here?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…