Skip to content

Instantly share code, notes, and snippets.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Client.config = .init(apiKey: "b67pax5b2wdq", logOptions: .info)
Client.shared.set(user: User(id: "polished-poetry-5"),
token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoicG9saXNoZWQtcG9ldHJ5LTUifQ.o8SWzSlb68EntudwjVul1rUCYGpla-CimXNKxj3wKOc")
return true
}
import UIKit
import StreamChat
import StreamChatCore
class ContactsViewController: ChannelsViewController {
}
override func viewDidLoad() {
presenter = ChannelsPresenter(filter: .currentUserInMembers)
title = "Messages"
setupStyles()
tableView.tableFooterView = nil
navigationItem.largeTitleDisplayMode = .always
import UIKit
import StreamChat
class ContactListCell: ChannelTableViewCell {
static var reuseIdentifier: String {
return String(describing: self)
}
private let unreadView = UIView()
override func updateChannelCell(_ cell: ChannelTableViewCell, channelPresenter: ChannelPresenter) {
super.updateChannelCell(cell, channelPresenter: channelPresenter)
if let cell = cell as? ContactListCell {
cell.isUnread = channelPresenter.isUnread
}
}
tableView.register(ContactListCell.self, forCellReuseIdentifier: ContactListCell.reuseIdentifier)
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
import UIKit
import StreamChat
import RxSwift
class MessagesViewController: ChatViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.largeTitleDisplayMode = .never
override func createChatViewController(with channelPresenter: ChannelPresenter) -> ChatViewController {
MessagesViewController(nibName: nil, bundle: nil)
}
private let cameraButton = UIButton()
private let soundRecordButton = UIButton()