質問編集履歴

4

a

2020/09/09 05:25

投稿

kazuki_user
kazuki_user

スコア147

test CHANGED
File without changes
test CHANGED
@@ -96,6 +96,10 @@
96
96
 
97
97
  var repo: [[String: Any]]=[] // 必要?
98
98
 
99
+ // 記述しない場合... Use of unresolved identifier 'repo'
100
+
101
+ // 記述した場合... No exact matches in call to subscript
102
+
99
103
 
100
104
 
101
105
  override func awakeFromNib() {

3

a

2020/09/09 05:25

投稿

kazuki_user
kazuki_user

スコア147

test CHANGED
File without changes
test CHANGED
@@ -80,30 +80,6 @@
80
80
 
81
81
 
82
82
 
83
- ## 参考
84
-
85
-
86
-
87
- Udemyにて以下のようなコードで学んだのですが、
88
-
89
- 上記のケースに上手く応用できないので、どなたか方法を教えて頂きたいです。????‍♂️
90
-
91
-
92
-
93
- ```swift
94
-
95
- func configureCell(category: FoodCategory) {
96
-
97
- categoryImg.image = UIImage(named: category.imageName)
98
-
99
- categoryTitle.text = category.title
100
-
101
- }
102
-
103
- ```
104
-
105
-
106
-
107
83
  ## 追記
108
84
 
109
85
 
@@ -146,32 +122,6 @@
146
122
 
147
123
 
148
124
 
149
- ```VC
150
-
151
- override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
152
-
153
-
154
-
155
- let cell: RepositoryCell = tableView.dequeueReusableCell(withIdentifier: Identifiers.RepositoryCell, for: indexPath) as! RepositoryCell
156
-
157
- let rp = repo[indexPath.row]
158
-
159
-
160
-
161
- // VCにエラーは無し。
162
-
163
-
164
-
165
- cell.configureCell(_repo: rp)
166
-
167
- cell.tag = indexPath.row
168
-
169
- return cell
170
-
171
- }
172
-
173
- ```
174
-
175
125
 
176
126
 
177
127
  質問は以上です。

2

a

2020/09/09 05:23

投稿

kazuki_user
kazuki_user

スコア147

test CHANGED
File without changes
test CHANGED
@@ -104,6 +104,74 @@
104
104
 
105
105
 
106
106
 
107
+ ## 追記
108
+
109
+
110
+
111
+ ```Cell
112
+
113
+ import UIKit
114
+
115
+
116
+
117
+ class RepositoryCell: UITableViewCell {
118
+
119
+
120
+
121
+ var repo: [[String: Any]]=[] // 必要?
122
+
123
+
124
+
125
+ override func awakeFromNib() {
126
+
127
+ super.awakeFromNib()
128
+
129
+ }
130
+
131
+
132
+
133
+ func configureCell(_repo: Dictionary<String, Any>) {
134
+
135
+     // 以下2行にエラー。
136
+
137
+ self.textLabel?.text = repo["full_name"] as? String ?? "" // No exact matches in call to subscript
138
+
139
+ self.detailTextLabel?.text = repo["language"] as? String ?? "" // No exact matches in call to subscript
140
+
141
+ }
142
+
143
+ }
144
+
145
+ ```
146
+
147
+
148
+
149
+ ```VC
150
+
151
+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
152
+
153
+
154
+
155
+ let cell: RepositoryCell = tableView.dequeueReusableCell(withIdentifier: Identifiers.RepositoryCell, for: indexPath) as! RepositoryCell
156
+
157
+ let rp = repo[indexPath.row]
158
+
159
+
160
+
161
+ // VCにエラーは無し。
162
+
163
+
164
+
165
+ cell.configureCell(_repo: rp)
166
+
167
+ cell.tag = indexPath.row
168
+
169
+ return cell
170
+
171
+ }
172
+
173
+ ```
174
+
107
175
 
108
176
 
109
177
  質問は以上です。

1

a

2020/09/09 01:51

投稿

kazuki_user
kazuki_user

スコア147

test CHANGED
@@ -1 +1 @@
1
- 他のViewを参照し、VCにデータを引っ張りたい。【MVC】
1
+ Viewを参照し、VCにデータを引っ張りたい。【MVC】
test CHANGED
File without changes