NoChat is a Swift lightweight chat framework base on Chatto.
Along with NoChat, there are three companion frameworks: NoChatTG, NoChatMM, NoChatSLK.
These companion frameworks are just different user interface, you can custom your own with NoChat :].
- 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
- Supports custom message bubble and toolbar
- Invert mode
- iOS 8.0+
- Xcode 7.3 or above
Include the following in your Podfile
:
pod 'NoChat'
Import the framework you want to use
import NoChat
You can create a subclass of ChatViewController
, and provide the data.
class TGChatViewController: ChatViewController {
// ...
override func viewDidLoad() {
inverted = true
super.viewDidLoad()
}
// Setup chat items
override func createPresenterBuilders() -> [ChatItemType: [ChatItemPresenterBuilderProtocol]] {
return [
DateItem.itemType : [
DateItemPresenterBuider()
],
MessageType.Text.rawValue : [
MessagePresenterBuilder<TextBubbleView, TGTextMessageViewModelBuilder>(
viewModelBuilder: TGTextMessageViewModelBuilder(),
layoutCache: messageLayoutCache
)
]
]
}
// Setup chat input views
override func createChatInputViewController() -> UIViewController {
let inputController = NoChatTG.ChatInputViewController()
// ...
return inputController
}
// ...
}
And I also suggest you custom the view controller of chat with the protocols provide by NoChat.
I mean you can write your own ChatViewController
without NoChat.ChatViewController
.
Source code is mind, not just code, I think.
The architechture of the chat UI looks like this:
See the Demo project inside.
Why call it NoChat
?
Because the boss let us write many apps with chat UI,
sorry I really don't want to write chat UI anymore 😢
Source code is distributed under MIT license.