提交工单
咨询集成、功能及报价等问题
The conversation component of the In-app Chat Kit provides the chat list and chat features.
Integrate the In-app Chat Kit SDK into your project (finished the initialization and login are required). For more information, see Quick start.
import UIKit
import ZIMKit
/// your ViewController.swift
class ViewController: UIViewController {
}
import UIKit
import ZIMKit
/// your ViewController.swift
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
/// Call the following method to display the chat list after login succeeded.
func showConversationListVC(_ sender: Any) {
let conversationVC = ZIMKitConversationListVC()
let nav = UINavigationController(rootViewController: conversationVC)
nav.modalPresentationStyle = .fullScreen
self.present(nav, animated: true)
}
}
If the default conversation-relevant features and behaviors don't fully meet your needs, we allow you to flexibly customize those through the config we mentioned in this section.
To customize click event logic, you can listen to the callback on a Conversation
clicked by implementing the delegate ZIMKitConversationListVCDelegate
.
import UIKit
import ZIMKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let conversationVC = ZIMKitConversationListVC()
conversationVC.delegate = self
}
}
extension ViewController: ZIMKitConversationListVCDelegate {
/// Callback on a conversation clicked.
/// - Parameters:
/// - conversationListVC: ZIMKitConversationListVC
/// - conversation: conversation model
/// - defaultAction: Clicking will jump to the message page by default.
func conversationList(_ conversationListVC: ZIMKitConversationListVC, didSelectWith conversation: ZIMKitConversation, defaultAction: () -> ()) {
// You can add your event handling logic here.
}
}