###前提・実現したいこと
swift3でFirebase、JSQMessageControllerをcocoapodsで導入し、
簡易的なチャットアプリを実装しようとしています。
http://www.atmarkit.co.jp/ait/articles/1606/06/news020.html
こちらのページを参考にしています。
swiftのベージョンが違うようで、
いくつか書き換えをしたのですが、
以下の部分のエラーだけは解決できませんでした。
お知恵をお貸しいただけると非常に助かります。
いつもありがとうございます。
###発生している問題・エラーメッセージ
cannot call the value of non-functional type ‘JSQMessageCollectionView!'
###該当のソースコード
コメントで避難させてあるのが元のソースコード、
その下の部分が自分なりに書き換えたコードとなります。
このコードで上記のエラーメッセージが出ています。
/* override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = super.collectionView(collectionView, cellForItemAtIndexPath: indexPath) as? JSQMessagesCollectionViewCell if messages[indexPath.row].senderId == senderId { cell?.textView?.textColor = UIColor.whiteColor() } else { cell?.textView?.textColor = UIColor.darkGrayColor() } return cell! } override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return messages.count } */ override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = super.collectionView(collectionView, cellForItemAtIndexPath: indexPath) as? JSQMessagesCollectionViewCell if messages[indexPath.row].senderId == senderId { cell?.textView?.textColor = UIColor.whiteColor() } else { cell?.textView?.textColor = UIColor.darkGrayColor() } return cell! }
###補足情報(言語/FW/ツール等のバージョンなど)
Xcode8 swift3 iOS10
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。