Skip to content

Commit c24745b

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

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

Onout Watch App/ContentView.swift

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,46 @@
1-
//
2-
// ContentView.swift
3-
// Onout Watch App
4-
//
5-
// Created by Никита Иванов on 03.10.2023.
6-
//
7-
81
import SwiftUI
92

103
struct ContentView: View {
114
@StateObject private var viewModel = BalanceViewModel()
125

136
@State private var inputString = ""
147
@State private var showingInputDialog = false
15-
8+
169
var body: some View {
1710
VStack {
11+
Image(systemName: "globe")
12+
.imageScale(.large)
13+
.foregroundStyle(.tint)
14+
Text("Hello, world!")
1815
Text("Balance:")
1916
.font(.headline)
2017
.padding()
2118
Text("$\(Int(viewModel.balance))")
2219
.font(.title)
2320
.padding()
24-
25-
TextField("Enter new wallet", text: $inputString, onCommit: {
26-
viewModel.updateWallet(wallet: inputString)
27-
28-
})
29-
.textFieldStyle(.plain)
30-
21+
22+
Button("Add new wallet") {
23+
showingInputDialog = true
24+
}
25+
.actionSheet(isPresented: $showingInputDialog) {
26+
ActionSheet(title: Text("Choose input method"), buttons: [
27+
.default(Text("Enter on iPhone")) {
28+
// Present a view or a screen on iPhone for input
29+
},
30+
.default(Text("Enter on Watch")) {
31+
// Here you can retain the existing logic or modify as needed for the watch input
32+
},
33+
.cancel()
34+
])
35+
}
3136
.padding()
3237
}
38+
.padding()
3339
}
3440
}
3541

36-
37-
#Preview {
38-
ContentView()
42+
struct ContentView_Previews: PreviewProvider {
43+
static var previews: some View {
44+
ContentView()
45+
}
3946
}

0 commit comments

Comments
 (0)