質問編集履歴

8

2021/11/11 08:01

投稿

atekasu
atekasu

スコア8

test CHANGED
File without changes
test CHANGED
File without changes

7

2021/11/11 08:01

投稿

atekasu
atekasu

スコア8

test CHANGED
File without changes
test CHANGED
File without changes

6

2021/11/11 08:01

投稿

atekasu
atekasu

スコア8

test CHANGED
File without changes
test CHANGED
File without changes

5

2021/11/11 08:01

投稿

atekasu
atekasu

スコア8

test CHANGED
File without changes
test CHANGED
File without changes

4

2021/11/11 08:01

投稿

atekasu
atekasu

スコア8

test CHANGED
@@ -1 +1 @@
1
- TextFieldをforEachを使って簡略化する方法
1
+ TextFieldをforEachを使って簡略化する方法
test CHANGED
@@ -1,10 +1,10 @@
1
- TextFieldをforEachを使って簡略化しようとしましたが
1
+ TextFieldの文章データsharedataに上書きするプログラムをforEachを使って簡略化しようとしましたが
2
2
 
3
3
  erro:Value of type 'goal' has no member 'append'
4
4
 
5
5
  と表示されてしまします。
6
6
 
7
- 省略せずにtextfieldを4回書いた方がいいのでしょうか?
7
+
8
8
 
9
9
  ```
10
10
 

3

2021/11/11 08:01

投稿

atekasu
atekasu

スコア8

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  @EnvironmentObject var data:Sharedata
18
18
 
19
- let list = ["年齢","名前","性別","好きな果物"]
19
+ let list = ["名前","性別","好きな果物"]
20
20
 
21
21
  @State var inPut:String = ""
22
22
 

2

誤字

2021/11/11 07:59

投稿

atekasu
atekasu

スコア8

test CHANGED
File without changes
test CHANGED
@@ -62,57 +62,7 @@
62
62
 
63
63
 
64
64
 
65
- import SwiftUI
66
65
 
67
-
68
-
69
- struct goal: View {
70
-
71
- @EnvironmentObject var data:Sharedata
72
-
73
- let list = ["年齢","名前","性別","好きな果物"]
74
-
75
- @State var inPut:String = ""
76
-
77
- var body: some View {
78
-
79
- NavigationView{
80
-
81
- VStack{
82
-
83
- ForEach(0..<list.count){index in
84
-
85
- TextField("(index)",text: $inPut) {
86
-
87
- self.append.data.listData(self.inPut)
88
-
89
- })
90
-
91
- }
92
-
93
- }
94
-
95
- }
96
-
97
- }
98
-
99
- }
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
- struct goal_Previews: PreviewProvider {
108
-
109
- static var previews: some View {
110
-
111
- goal().environmentObject(Sharedata())
112
-
113
- }
114
-
115
- }
116
66
 
117
67
  ```
118
68
 

1

誤字

2021/11/09 09:24

投稿

atekasu
atekasu

スコア8

test CHANGED
File without changes
test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  ForEach(0..<list.count){index in
30
30
 
31
- TextField("(index)",text: $inPut, onCommit: {
31
+ TextField("(index)",text: $inPut{
32
32
 
33
33
  self.append.data.listData(self.inPut)
34
34
 
@@ -82,7 +82,7 @@
82
82
 
83
83
  ForEach(0..<list.count){index in
84
84
 
85
- TextField("(index)",text: $inPut, onCommit: {
85
+ TextField("(index)",text: $inPut) {
86
86
 
87
87
  self.append.data.listData(self.inPut)
88
88