Skip to content

Instantly share code, notes, and snippets.

@ChrisMash
Created February 16, 2022 12:42
Show Gist options
  • Save ChrisMash/27b501ecec57d1970928b0221dc27eb7 to your computer and use it in GitHub Desktop.
Save ChrisMash/27b501ecec57d1970928b0221dc27eb7 to your computer and use it in GitHub Desktop.
Snapshot of HandView from https://github.com/ChrisMash/SwiftUI-Playing-Cards for my blog
// A view to represent the cards in a hand
struct HandView: View {
@ObservedObject var hand: Hand
let namespace: Namespace.ID
let onCardTap: (Card) -> Void
var body: some View {
HStack {
ForEach(hand.cards) { card in
CardView(card: card, namespace: namespace)
.onTapGesture {
onCardTap(card)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment