Skip to content

Commit c1f5688

Browse files
authored
Update ContentView.swift
1 parent c24745b commit c1f5688

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

Onout Watch App/ContentView.swift

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import SwiftUI
33
struct ContentView: View {
44
@StateObject private var viewModel = BalanceViewModel()
55

6-
@State private var inputString = ""
76
@State private var showingInputDialog = false
7+
@State private var showWalletInputView = false
88

99
var body: some View {
1010
VStack {
@@ -25,14 +25,41 @@ struct ContentView: View {
2525
.actionSheet(isPresented: $showingInputDialog) {
2626
ActionSheet(title: Text("Choose input method"), buttons: [
2727
.default(Text("Enter on iPhone")) {
28-
// Present a view or a screen on iPhone for input
28+
showWalletInputView = true
2929
},
3030
.default(Text("Enter on Watch")) {
31-
// Here you can retain the existing logic or modify as needed for the watch input
31+
// Logic for watch input (if any)
3232
},
3333
.cancel()
3434
])
3535
}
36+
.sheet(isPresented: $showWalletInputView) {
37+
WalletInputView(viewModel: viewModel)
38+
}
39+
.padding()
40+
}
41+
.padding()
42+
}
43+
}
44+
45+
struct WalletInputView: View {
46+
@ObservedObject var viewModel: BalanceViewModel
47+
@State private var inputString = ""
48+
@Environment(\.dismiss) var dismiss
49+
50+
var body: some View {
51+
VStack {
52+
TextField("Enter new wallet", text: $inputString, onCommit: {
53+
viewModel.updateWallet(wallet: inputString)
54+
dismiss()
55+
})
56+
.textFieldStyle(.roundedBorder)
57+
.padding()
58+
59+
Button("Submit") {
60+
viewModel.updateWallet(wallet: inputString)
61+
dismiss()
62+
}
3663
.padding()
3764
}
3865
.padding()

0 commit comments

Comments
 (0)