Skip to content

BaseChatViewController

Diego Sánchez edited this page Jul 4, 2016 · 1 revision

BaseChatViewController

The base UIViewController you must subclass

Needs an input bar:

public func createChatInputView() -> UIView {
    assert(false, "Override in subclass")
    return UIView()
}

Needs a Data source:

public final func setChatDataSource(dataSource: ChatDataSourceProtocol?, triggeringUpdateType updateType: UpdateType?) {
    ...
}

Needs to know how to create Presenters for your ChatItems:

public func createPresenterFactory() -> ChatItemPresenterFactoryProtocol {
    // Default implementation
    return ChatItemPresenterFactory(presenterBuildersByType: self.createPresenterBuilders())
}

If you stick to the default implementation then you must override createPresenterBuilders

public typealias ChatItemType = String
public func createPresenterBuilders() -> [ChatItemType: [ChatItemPresenterBuilderProtocol]] {
    assert(false, "Override in subclass")
    return [ChatItemType: [ChatItemPresenterBuilderProtocol]]()
}
Clone this wiki locally