Chatto 是一个 Swift 的聊天框架,可以很容易地实现类似信息 app 那样的聊天界面,包括图片发送,内容分页,可交互的键盘等等,是一个实现非常完整的解决方案。
示例代码:
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 }