0

I am working on a chess game in SwiftUI and I need a way to remove images (pieces) from board. Each pieces is created with the following code. GeometryReader { geo in Image(name) .resizable() .frame(width: CGFloat(cellSize), height: CGFloat(cellSize)) .scaledToFit() .position(location) .gesture(DragGesture() .onChanged { value in withAnimation(.spring()) { location = value.location } } .onEnded { value in withAnimation(.spring()) { print("Location: ", location) print("name: ", name) print("startlocation: ", value.startLocation) (location, placement.pieces) = placement.checkSpot(loc: value.location, size: cellSize, start: value.startLocation, name: name, pieces: placement.pieces) } } ) }

I looked through the documentation and YouTube videos and could not find a .remove/.delete command or any help on this. I found a lot of help on adding/resizing/moving the image but nothing on deleting one.

Rich64
  • 1

0 Answers0