一個基于Swift構建聊天應用的輕量級框架:Chatto
Chatto是一個Swift輕量級框架用于構建聊天應用。它被設計為可擴展和高性能。與Chatto一起的還有ChattoAdditions一個 companion 框架,它包括了消息氣泡,和一個可擴展的輸入組件。
特性
- 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
如何使用
- Subclass ChatViewController
- OverridecreateChatInputView()to useChattoAdditions.ChatInputBaror provide your own component
- Provide a data source with your messages
- 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 }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!