I am creating a simple card game (Set) in SwiftUI. I have a button that will deal X new cards when tapped. Currently, it makes all cards show up at once. I was wondering how I could make them come out one at a time.
Deal works by appending a new card to a Deck array in the model. ContentView displays each card in the grid.
Deal works by appending a new card to a Deck array in the model. ContentView displays each card in the grid.
Code Block func deal(_ numberOfCards: Int) { withAnimation(Animation.easeInOut(duration: 1)) { viewModel.deal() } for _ in 1..<numberOfCards { DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { withAnimation(.easeInOut) { viewModel.deal() } } } }