Chatto 是一個(gè) Swift 的聊天框架,可以很容易地實(shí)現(xiàn)類似信息 app 那樣的聊天界面,包括圖片發(fā)送,內(nèi)容分頁(yè),可交互的鍵盤等等,是一個(gè)實(shí)現(xiàn)非常完整的解決方案。
示例代碼:
override func createPresenterBuilders() -> [ChatItemType: [ChatItemPresenterBuilderProtocol]] { return [ TextMessageModel.chatItemType: [ TextMessagePresenterBuilder( viewModelBuilder: TextMessageViewModelDefaultBuilder(), interactionHandler: TextMessageHandler(baseHandler: self.baseMessageHandler) ) ] ] } override func createChatInputView() -> UIView { let chatInputView = ChatInputBar.loadNib() self.configureChatInputBar(chatInputView) self.chatInputPresenter = ChatInputBarPresenter(chatInputView: chatInputView, chatInputItems: self.createChatInputItems()) return chatInputView } override func viewDidLoad() { super.viewDidLoad() self.chatDataSource = self.myDataSource }