Prerequisites
- Sign up for an Ably account.
- Create a new app, and get your first API key.
- Create a new iOS project with SwiftUI in Xcode.
-
Add the Chat dependency to your project using Swift Package Manager:
- In Xcode, go to File > Add Package Dependencies
- Enter the repository URL:
https://github.com/ably/ably-chat-swift - Select the latest version and add it to your target
Step 1: Set Up Ably
In production, you should use token authentication to avoid exposing your API keys publicly. Replace the contents of yourContentView.swift file:
Step 2: Create a Room and Send Messages
Add functionality to create a room and send messages:Next Steps
- Understand token authentication before going to production
- Read more about using rooms and sending messages
- Find out more regarding presence
