File tree Expand file tree Collapse file tree 1 file changed +25
-18
lines changed Expand file tree Collapse file tree 1 file changed +25
-18
lines changed Original file line number Diff line number Diff line change 1
- //
2
- // ContentView.swift
3
- // Onout Watch App
4
- //
5
- // Created by Никита Иванов on 03.10.2023.
6
- //
7
-
8
1
import SwiftUI
9
2
10
3
struct ContentView : View {
11
4
@StateObject private var viewModel = BalanceViewModel ( )
12
5
13
6
@State private var inputString = " "
14
7
@State private var showingInputDialog = false
15
-
8
+
16
9
var body : some View {
17
10
VStack {
11
+ Image ( systemName: " globe " )
12
+ . imageScale ( . large)
13
+ . foregroundStyle ( . tint)
14
+ Text ( " Hello, world! " )
18
15
Text ( " Balance: " )
19
16
. font ( . headline)
20
17
. padding ( )
21
18
Text ( " $ \( Int ( viewModel. balance) ) " )
22
19
. font ( . title)
23
20
. 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
+ }
31
36
. padding ( )
32
37
}
38
+ . padding ( )
33
39
}
34
40
}
35
41
36
-
37
- #Preview {
38
- ContentView ( )
42
+ struct ContentView_Previews : PreviewProvider {
43
+ static var previews : some View {
44
+ ContentView ( )
45
+ }
39
46
}
You can’t perform that action at this time.
0 commit comments