Last active
February 16, 2022 19:44
-
-
Save ChrisMash/4faa01218443edddb4fd50805091c58c to your computer and use it in GitHub Desktop.
Snapshot of DeckView from https://github.com/ChrisMash/SwiftUI-Playing-Cards for my blog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct DeckView: View { | |
| @ObservedObject var deck: Hand | |
| let namespace: Namespace.ID | |
| var body: some View { | |
| ZStack { | |
| // Just need to draw the last two so that the transition of card | |
| // from the hand back to the deck results in the old top card being | |
| // rendered as the new top card animates in | |
| ForEach(deck.cards.suffix(2)) { | |
| CardView(card: $0, namespace: namespace) | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment