質問編集履歴
1
変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,2 +1,15 @@
|
|
1
|
+
Udemyで以下のようなお手本コードがあったのですが、as! ProfileCellでダウンキャストをしなくてもビルドできました。
|
2
|
+
|
3
|
+
|
4
|
+
```ここに言語を入力
|
5
|
+
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
6
|
+
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! ProfileCell
|
7
|
+
return cell
|
8
|
+
}
|
9
|
+
```
|
10
|
+
|
1
|
-
|
11
|
+
上記のコードだけでは今回のダウンキャストするメリットはわからないかもしれませんが、一般的にダウンキャストするメリットはどのようなものがあるのでしょうか。
|
12
|
+
|
2
|
-
|
13
|
+
将来的に、自分自身でコードを書くときために知りたいです。
|
14
|
+
|
15
|
+
よろしくお願いいたします。
|