Post

Replies

Boosts

Views

Activity

Reply to How to fix these errors?
I am on class 2 of memorize game and got "scope" error too. //start code import SwiftUI struct ContentView: View {     var emoji = ["👩‍🚀","🕵️‍♂️","👩‍🔬","🦾","💃" ,"🦸‍♀️" ,"👨‍🍳" ,"🧑‍🎤" ,"👨‍⚖️" ,"👩‍🌾" ,"👷‍♀️" ,"💂‍♀️" ,"👲" ,"🕴" ,"👩‍🚒" ,"🦹‍♂️" ,"👰‍♀️" ,"👨‍💻" ,"🥷" ,"🙅" ,"🧟‍♂️" ,"🤶" , "🧑‍🎨","🧛‍♂️", "🧞‍♂️","🧌 "]      @State var EmojiCounting = 3     var body: some View {         VStack{         HStack{             ForEach(emoji[0..<EmojiCounting], id: .self) { emoji in CardView(content: emoji)             }}             HStack {                 remove                 Spacer()                 add}                      .padding(.horizontal)         .foregroundColor(.red)         }}} var remove: some View {     return Button (action: {EmojiCounting -= 1}, label: {     VStack {         Text("Remove")         Text("Card")     }})} var add: some View {     Button(action: {     EmojiCounting += 1 }, label: {     VStack {         Text("Add")         Text("Card")     }})} struct CardView: View {     var content: String   @State var isFaceUp: Bool = true          var body: some View {         ZStack {             let shape = RoundedRectangle(cornerRadius: 20)             if isFaceUp {             shape.fill().foregroundColor(.white)             shape.stroke(lineWidth: 3)             Text(content).font(.largeTitle)             } else {                 shape.fill()             }         }                  .onTapGesture {             isFaceUp = !isFaceUp         }              }      }          struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()                      }}
Aug ’22