Skip to content

Instantly share code, notes, and snippets.

@ChrisMash
Created February 16, 2022 12:31
Show Gist options
  • Save ChrisMash/6d42fde76b60757afe953753456f6284 to your computer and use it in GitHub Desktop.
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
// 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