teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

文法修正

2020/05/09 17:40

投稿

Chiaki1111
Chiaki1111

スコア15

title CHANGED
File without changes
body CHANGED
@@ -6,7 +6,6 @@
6
6
  ### 発生している問題・エラーメッセージ
7
7
 
8
8
  ```
9
- Instance member 'status' cannot be used on type 'ThemeObserver'; did you mean to use a value of this type instead?
10
9
  Type '()' cannot conform to 'View'; only struct/enum/class types can conform to protocols
11
10
 
12
11
  ```
@@ -40,9 +39,10 @@
40
39
  }
41
40
 
42
41
  class OpenAnnouncementObserver: ObservableObject {
42
+ @ObservedObject var observed = ThemeObserver()
43
43
  @Published var themeList: [String]
44
44
  init() {
45
- ForEach(ThemeObserver.status){ theme in ←ここでエラー発生
45
+ ForEach(observed.status){ theme in ←ここでエラー発生
46
46
  if theme.status == "announcement" { ←ここでエラー発生
47
47
  self.themeList.append(theme.id)
48
48
  }