Layer-Parse-iOS-Swift-Example
Layer-Parse-iOS-Swift-Example copied to clipboard
error when implement ATLConversationViewControllerDataSource
this is my code :
class test: ATLConversationViewController, ATLConversationViewControllerDataSource, ATLConversationViewControllerDelegate {
var dateFormatter: NSDateFormatter = NSDateFormatter()
var usersArray: NSArray!
override func viewDidLoad() {
super.viewDidLoad()
self.dataSource = self
self.delegate = self
print("addressBarController: \(self.addressBarController)")
self.addressBarController.delegate = self
// Uncomment the following line if you want to show avatars in 1:1 conversations
// self.shouldDisplayAvatarItemForOneOtherParticipant = true
// Setup the dateformatter used by the dataSource.
self.dateFormatter.dateStyle = NSDateFormatterStyle.ShortStyle
self.dateFormatter.timeStyle = NSDateFormatterStyle.ShortStyle
self.configureUI()
}
// MARK - UI Configuration methods
func configureUI() {
ATLOutgoingMessageCollectionViewCell.appearance().messageTextColor = UIColor.whiteColor()
}
// MARK - ATLConversationViewControllerDelegate methods
func conversationViewController(viewController: ATLConversationViewController, didSendMessage message: LYRMessage) {
print("Message sent!")
}
func conversationViewController(viewController: ATLConversationViewController, didFailSendingMessage message: LYRMessage, error: NSError?) {
print("Message failed to sent with error: \(error)")
}
func conversationViewController(viewController: ATLConversationViewController, didSelectMessage message: LYRMessage) {
print("Message selected")
}
// MARK - ATLConversationViewControllerDataSource methods
func conversationViewController(conversationViewController: ATLConversationViewController, participantForIdentifier participantIdentifier: String) -> ATLParticipant? {
let user = PFUser()
return user
}
func conversationViewController(conversationViewController: ATLConversationViewController, attributedStringForDisplayOfDate date: NSDate) -> NSAttributedString {
return NSAttributedString()
}
func conversationViewController(conversationViewController: ATLConversationViewController, attributedStringForDisplayOfRecipientStatus recipientStatus: [NSObject:AnyObject]) -> NSAttributedString {
return NSAttributedString()
}
}
and this is error : Type 'test' does not conform to protocol 'ATLConversationViewControllerDataSource'