I'm using the MessageKit for chating when I calling the its delegate and datasource it saying (Cannot find 'messagesCollectionView' in scope) please see the code and guide me thanks.
import UIKit
import FirebaseAuth
import MessageKit
struct Message: MessageType{
var sender: SenderType
var messageId: String
var sentDate: Date
var kind: MessageKind
}
struct sender: SenderType{
var photo: String
var senderId: String
var displayName: String
}
class ChatDashboard: UIViewController {
@IBOutlet weak var lblUser: UILabel!
var userActive: String? = nil
override func viewDidLoad() {
super.viewDidLoad()
messagesCollectionView.messagesDataSource = self
messagesCollectionView.messagesLayoutDelegate = self
messagesCollectionView.messagesDisplayDelegate = self //not working delegate and datasource
if let userData = userActive{
self.lblUser.text = userData
}
}
override func viewDidAppear(_ animated: Bool) {
}
}
Have a look at their example project usage. Should clear out lots of confusion.
Link: https://github.com/MessageKit/MessageKit/tree/master/Example
As for your query,
Can't find messagesCollectionView
because MessagesViewController
needs to be extended to access that.