VGChatClient
Before you can start a chat, the Client SDK needs to authenticate to the Vonage servers. The following additions are required to ContentView.swift.
At the top of the file, import VonageClientSDKChat:
Create a new class at the bottom of the file called LoginViewModel:
This class will create an instance of VGChatClient then create a session using a JWT. Replace ALICE_JWT and BOB_JWT with the JWTs you created earlier.
Button Actions
For the log in buttons to work, you need to add actions to them which will run a function when they are tapped. Update the view code to instantiate a LoginViewModel object and call its login function:
If there is an error when creating a session, an Alert will be presented with the error message. There is also a navigationDestination destination which will open the chat screen if the session is created successfully. You will build that in the next step.
Creating an iOS chat app
Create a iOS application that enables users to message each other