質問編集履歴

8

修正

2023/04/17 03:11

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -41,7 +41,7 @@
41
41
  }
42
42
 
43
43
  struct NextView: View {
44
- @State var bcolor: Bool
44
+ @State var backcolor: Bool
45
45
  var body: some View {
46
46
  List{Section(header: Text("背景色").listRowBackground(Rectangle()
47
47
  .background(Color.clear)

7

修正

2023/04/17 03:11

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
  struct ContentView{
25
25
  let list = ["a", "b", "c"]
26
26
  var body: some View {
27
- @Binding var bcolor = false
27
+ @Binding var backcolor = false
28
28
  NavigationView {
29
29
  VStack{
30
30
  List {
@@ -45,9 +45,9 @@
45
45
  var body: some View {
46
46
  List{Section(header: Text("背景色").listRowBackground(Rectangle()
47
47
  .background(Color.clear)
48
- .foregroundColor(bcolor ? Color.gray : Color.white)
48
+ .foregroundColor(backcolor ? Color.gray : Color.white)
49
49
  .opacity(0.3) )
50
- .foregroundColor(bcolor ? Color.white : Color.black)){Toggle(isOn: $bcolor) {}}}.scrollContentBackground(.hidden).background(bcolor ? Color.black : Color.white)}
50
+ .foregroundColor(backcolor ? Color.white : Color.black)){Toggle(isOn: $backcolor) {}}}.scrollContentBackground(.hidden).background(backcolor ? Color.black : Color.white)}
51
51
  }
52
52
 
53
53
  ```

6

修正

2023/04/17 03:09

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -21,8 +21,9 @@
21
21
 
22
22
  ```Swift
23
23
 
24
- struct ContentView{var body: some View {
24
+ struct ContentView{
25
25
  let list = ["a", "b", "c"]
26
+ var body: some View {
26
27
  @Binding var bcolor = false
27
28
  NavigationView {
28
29
  VStack{

5

追記

2023/04/17 03:08

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  SecondViewにToggle
8
8
  ContentViewに変更したい背景色があります。
9
+
10
+ Toggleのある画面では、変化するのですが別画面ではしません。
9
11
 
10
12
  ### 発生している問題・エラーメッセージ
11
13
 

4

修正

2023/04/17 03:06

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  ```Swift
21
21
 
22
- ContentView{var body: some View {
22
+ struct ContentView{var body: some View {
23
23
  let list = ["a", "b", "c"]
24
24
  @Binding var bcolor = false
25
25
  NavigationView {

3

コード修正

2023/04/17 03:06

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
  VStack{
27
27
  List {
28
28
  Section{
29
- ForEach(list) { cell in
29
+ ForEach(list) { text in
30
30
  NavigationLink {
31
31
  NextView()
32
32
  } label: {

2

コード修正

2023/04/17 03:05

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  ```
13
13
 
14
- Missing argument for parameter 'bcolor' in call
14
+ Missing argument for parameter 'backcolor' in call
15
15
 
16
16
  ```
17
17
 
@@ -26,7 +26,7 @@
26
26
  VStack{
27
27
  List {
28
28
  Section{
29
- ForEach(list) { text in
29
+ ForEach(list) { cell in
30
30
  NavigationLink {
31
31
  NextView()
32
32
  } label: {

1

コード修正

2023/04/17 03:03

投稿

ura4
ura4

スコア14

test CHANGED
File without changes
test CHANGED
@@ -26,9 +26,9 @@
26
26
  VStack{
27
27
  List {
28
28
  Section{
29
- ForEach(list) { item in
29
+ ForEach(list) { text in
30
30
  NavigationLink {
31
- SettimgView()(bcolor: false)
31
+ NextView()
32
32
  } label: {
33
33
  Text("テキスト")
34
34
  }