Created
February 16, 2022 12:31
-
-
Save ChrisMash/6d42fde76b60757afe953753456f6284 to your computer and use it in GitHub Desktop.
Snapshot of CardView from https://github.com/ChrisMash/SwiftUI-Playing-Cards for my blog
This file contains 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
// A view to represent a single card | |
struct CardView: View { | |
let card: Card | |
let namespace: Namespace.ID | |
var body: some View { | |
ZStack { | |
RoundedRectangle(cornerRadius: 20, | |
style: .continuous) | |
.fill(Color.white) | |
RoundedRectangle(cornerRadius: 20, | |
style: .continuous) | |
.stroke(.black, lineWidth: 2) | |
Text("\(card.number)") | |
} | |
.frame(width: 60, height: 80) | |
.matchedGeometryEffect(id: "\(card.number)", | |
in: namespace) | |
.transition(.scale(scale: 1)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment