@@ -34,9 +34,7 @@ extension MSGMessengerViewController: UICollectionViewDataSource, UICollectionVi
3434 let identifier = message. user. isSender ? " outgoingText " : " incomingText "
3535 let cell = collectionView. dequeueReusableCell ( withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
3636
37- // TODO: set the delegate here
3837 cell. delegate = self
39-
4038 cell. message = message
4139 cell. style = style
4240 cell. isLastInSection = isLast
@@ -56,8 +54,9 @@ extension MSGMessengerViewController: UICollectionViewDataSource, UICollectionVi
5654 let cell = collectionView. dequeueReusableCell ( withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
5755
5856 cell. delegate = self
59-
6057 cell. message = message
58+ cell. style = style
59+ cell. isLastInSection = isLast
6160
6261 return cell
6362
@@ -68,22 +67,33 @@ extension MSGMessengerViewController: UICollectionViewDataSource, UICollectionVi
6867 let cell = collectionView. dequeueReusableCell ( withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
6968
7069 cell. delegate = self
71-
7270 cell. message = message
71+ cell. style = style
72+ cell. isLastInSection = isLast
7373
7474 return cell
7575
7676
7777 case . video:
78- fatalError ( " video cell not defined " )
79- break
78+
79+ let identifier = message. user. isSender ? " outgoingVideo " : " incomingVideo "
80+ let cell = collectionView. dequeueReusableCell ( withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
81+
82+ cell. delegate = self
83+ cell. message = message
84+ cell. style = style
85+ cell. isLastInSection = isLast
86+
87+ return cell
8088
8189 case . custom:
8290 let identifier = message. user. isSender ? " outgoingCustom " : " incomingCustom "
8391 let cell = collectionView. dequeueReusableCell ( withReuseIdentifier: identifier, for: indexPath) as! MSGMessageCell
8492
8593 cell. delegate = self
8694 cell. message = message
95+ cell. style = style
96+ cell. isLastInSection = isLast
8797
8898 return cell
8999 }
0 commit comments