So I am trying to state a private variable in Xcode SwiftUI, and it gives me this error:
I don't know where to put the line of code in the script without it breaking! Help please!
So I am trying to state a private variable in Xcode SwiftUI, and it gives me this error:
I don't know where to put the line of code in the script without it breaking! Help please!
You have to declare the State var BEFORE the body:
struct ContentView: View
@State private var imagesCount = 0
var body: some View {
VStack {
// etc