Testing your Code
At this point, your VonageVideoSDK.swift file should look something like this (with a few adjustments):
In your completed code, you should have hard coded values to replace YOUR_APP_ID, YOUR_SESSION_ID and YOUR_TOKEN — if you haven't done this, see Setting up authentication above.
Your ContentView.swift file should look like this:
- Build and run the app in Xcode (CMD + R).
- Enter some text into the textfield and send it.
- You should see the message get added to the message history.
Next, we can test what it looks like if someone else sends a message. We can simulate that by running the app again on a different simulator/device:
- Build and run the app on a different simulator.
- Reopen the app on the original simulator.
- Enter some text into the textfield and send it on both simulators.
- You should see a both messages get added to the message history.
Troubleshooting tip: If you cant connect to the session, check the Xcode console for errors. The most likely issue is that your API key, session ID, or token is not set up properly. Since you hard coded your credentials, it's also possible that your token has expired.
Basic text chat
Follow this tutorial to build basic text chat from scratch using the Vonage Video API. It is the quickest way to build a proof of concept for this functionality on the video platform.