Skip to main content

Chat

Chat List ViewController

Once the SDK is initialized and the user is authenticated, you can display the chat on your app:

public static func chatViewController(specialityID: String) async throws -> UIViewController
errors
  • Framework not initializated or user not authenticated
MeetingDoctorsError.illegalStateException(reason: .frameworkInitializationFailed))
  • Installation not created
MeetingDoctorsError.illegalStateException(reason: .installationNotCreated))
  • The chat screen can be displayed independently without relaying on the consultations list navigation.
Task {
do {
let viewController = try await MeetingDoctors.chatViewController(specialityID: text)
let navigationController = WLNavigationController(rootViewController: viewController)

navigationController.modalPresentationStyle = .fullScreen
present(navigationController, animated: true)
} catch {
print("[ProfileMainViewController] - \(error)")
}

}
  • When using the previous method to display the chat, the integrator can use the notification Center to get a notified and react to the user leaving the chat.
NotificationCenter
.default
.addObserver(self,
selector: #selector(self.chatClosed),
name: Notification.Name.MeetingDoctors.Chat.Closed,
object: nil)

@objc func chatClosed() {
NSLog("[TabBarViewController] - 🔴 Chat closed")
}