Skip to content

Instantly share code, notes, and snippets.

private func setupUI() {
view.addSubview(cameraButton)
cameraButton.translatesAutoresizingMaskIntoConstraints = false
cameraButton.setImage(UIImage(systemName: "camera.fill",
withConfiguration: UIImage.SymbolConfiguration(font: .systemFont(ofSize: 24))),
for: .normal)
cameraButton.tintColor = UIColor.gray.withAlphaComponent(0.7)
view.addSubview(soundRecordButton)
soundRecordButton.translatesAutoresizingMaskIntoConstraints = false
private let cameraButton = UIButton()
private let soundRecordButton = UIButton()
override func createChatViewController(with channelPresenter: ChannelPresenter) -> ChatViewController {
MessagesViewController(nibName: nil, bundle: nil)
}
import UIKit
import StreamChat
import RxSwift
class MessagesViewController: ChatViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.largeTitleDisplayMode = .never
style.incomingMessage.avatarViewStyle = nil
style.incomingMessage.backgroundColor = UIColor(red: 233/255, green: 233/255, blue: 235/255, alpha: 1)
style.incomingMessage.borderColor = .clear
style.incomingMessage.textColor = .black
style.incomingMessage.font = .systemFont(ofSize: 17, weight: .regular)
style.incomingMessage.edgeInsets.left = 16
style.incomingMessage.infoFont = .systemFont(ofSize: 0)
style.incomingMessage.nameFont = .systemFont(ofSize: 0)
style.outgoingMessage.avatarViewStyle = nil
tableView.register(ContactListCell.self, forCellReuseIdentifier: ContactListCell.reuseIdentifier)
override func updateChannelCell(_ cell: ChannelTableViewCell, channelPresenter: ChannelPresenter) {
super.updateChannelCell(cell, channelPresenter: channelPresenter)
if let cell = cell as? ContactListCell {
cell.isUnread = channelPresenter.isUnread
}
}
import UIKit
import StreamChat
class ContactListCell: ChannelTableViewCell {
static var reuseIdentifier: String {
return String(describing: self)
}
private let unreadView = UIView()
override func viewDidLoad() {
presenter = ChannelsPresenter(filter: .currentUserInMembers)
title = "Messages"
setupStyles()
tableView.tableFooterView = nil
navigationItem.largeTitleDisplayMode = .always