-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ugh! Took forever to realize used wrong struct name in new screen. Ev…
…erything is functional now so yay!
- Loading branch information
Showing
3 changed files
with
128 additions
and
47 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// NewCardView.swift | ||
// CardStack | ||
// | ||
// Created by Stephen on 9/3/20. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct NewCardView: View { | ||
@Environment(\.presentationMode) var presentationMode | ||
@ObservedObject var cards: Cards | ||
@State private var name = "" | ||
@State private var cardBody = "" | ||
// @State private var amount = "" | ||
|
||
var body: some View { | ||
NavigationView { | ||
Form { | ||
TextField("Title", text: $name) | ||
TextField("Body", text: $cardBody) | ||
|
||
} | ||
.navigationBarTitle("New Card") | ||
.navigationBarItems(trailing: Button("Done") { | ||
// if let actualAmount = Int(self.amount) { | ||
let item = CardInfo(name: self.name, cardBody: self.cardBody) | ||
self.cards.items.append(item) | ||
self.presentationMode.wrappedValue.dismiss() | ||
// } | ||
}) | ||
} | ||
} | ||
} | ||
|
||
|
||
struct NewCardView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
NewCardView(cards: Cards()) | ||
} | ||
} |