一个基于Swift构建聊天应用的轻量级框架:Chatto

jopen 9年前

Chatto是一个Swift轻量级框架用于构建聊天应用。设计为可扩展高性能。与Chatto一起的还有ChattoAdditions一个 companion 框架,它包括了消息气泡,和一个可扩展的输入组件。

一个基于Swift构建聊天应用的轻量级框架:Chatto 一个基于Swift构建聊天应用的轻量级框架:Chatto 一个基于Swift构建聊天应用的轻量级框架:Chatto 一个基于Swift构建聊天应用的轻量级框架:Chatto

特性

  • Calculation of collection view changes and layout in background
  • Supports pagination in both directions and autoloading
  • Message count contention for fast pagination and rotation with thousands of messsages
  • Accessory view revealing by swiping from right
  • Interactive keyboard dismissal
  • Text bubbles
  • Photo bubbles
  • Extensible input bar

如何使用

  1. Subclass ChatViewController
  2. OverridecreateChatInputView()to useChattoAdditions.ChatInputBaror provide your own component
  3. Provide a data source with your messages
  4. OverridecreatePresenterBuilders(). There will be a presenter for each message that will be responsible for the UI of that message.
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  }

项目主页:http://www.open-open.com/lib/view/home/1448866193608