Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jacobsapps/b683cff113e2eb9e5eda93d21a0e8a71 to your computer and use it in GitHub Desktop.
Save jacobsapps/b683cff113e2eb9e5eda93d21a0e8a71 to your computer and use it in GitHub Desktop.
@Environment(\.modelContext) private var context
// ...
VStack(spacing: .zero) {
Text("Does this card represent you?")
.multilineTextAlignment(.center)
.font(.headline)
Button {
if let card = viewModel.card {
let entity = CardEntity.from(card)
context.insert(entity)
try? context.save()
onCardConfirmed(card)
}
} label: {
Text("Tap here to confirm and continue")
.multilineTextAlignment(.center)
.font(.headline)
.foregroundStyle(.blue)
}
.contentShape(Rectangle())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment