mitter.io
  • Welcome
  • Migrating from cloud to on-prem
  • Get mitter.io
    • Custom configuration
  • Getting started
    • Build Your First Android App
      • Setup
      • Authenticate a User
      • Start a Basic Chat
      • Selective Deliveries
      • Custom Payloads
    • Build Your First iOS App
      • Overview
      • Installation
      • Basic Setup
      • Receive Push Messages
      • Storyboard
      • Channel List
      • Channel Window
    • Build Your First Web App
      • Setting Up Your App
      • Start a Basic Chat
      • Selective Deliveries
    • Build Your First React Native app
  • Platform Reference
    • Introduction
    • Concepts
    • Authorization and Access
    • Calling the APIs
    • Users
    • Channels
      • Channel Streams and Typing Indicators
    • Messages
    • Delivery Endpoints (Push Notifications)
    • Federated Authentication
    • Basic Permissions and Privileges
    • ACLs and Advanced Permission Model
    • Metadata
  • SDKs
    • Android
      • Getting Started
      • Set up FCM
      • Presence and Timeline Events
      • Profiles, Pagination and Locators
      • Using the UI Framework
    • iOS
      • Installation
      • Basic Setup
      • Get the current user details
      • Create a Channel
      • Messaging
      • Push Messages
    • Javascript
      • Using the UI framework (web only)
      • For react-native
      • For node.js
      • TSDocs / JSDocs
      • For Typescript Users
    • Java (Backend)
Powered by GitBook
On this page
  1. SDKs
  2. iOS

Create a Channel

To create a new channel using the SDK, you need to create at least 2 Participant instances with the participant user IDs and pass them as an array to either to createDirectMessageChannel() or createGroupMessageChannel() function depending on the number of participants you have.

Let’s initialise two participants and create a direct message channel.

let stan = Participant(id: "csrCy-SJL3u-8AKMT-Wqv6y")
let rahul = Participant(id: "E3CAM-jjw8A-WeqDe-cWFe7")

Substitute the user IDs with your own user IDs here.

Now, call the function:

appDelegate.mitter.channels.createGroupMessageChannel(participants: [stan, rahul]) { result in
            switch result {
            case .success(let channelId):
                print("New channel created: \(channelId)")
            case .error:
                print("Couldn't create channel")
            }
        }

Run your project and now you should see a New channel created message in your console log along with the ID of the newly created channel.

Note down the ID because we’ll use it to send and receive some messages

PreviousGet the current user detailsNextMessaging

Last updated 6 years ago