Quick start : iOS SDK API : Start using ApiRTC

You can find here the first steps to start using apiRTC iOS SDK. A good starting point is also to look at our tutorials where we have described in details the different feature integration.

Create your Apizee account to get your apiKey

Apikey is used to authentify your account and isolate your users. Create your account on our dasboard using following link : GET AN ACCOUNT

Add apiRTC SDK in your application

Use Swift Package Manager to add apiRTCSDK in your application with the Github link.

Create your User Agent

First of all, you need to create a User Agent.

User Agent is the starting point of apiRTC and enable you to manage several important aspects such as :

In this quick start, we create a User Agent using apiKey :

    var ua = UserAgent(UserAgentOptions(uri: .apzkey("[put api key here]")))

Register your User Agent

In order to start communicating with other users, User Agent has to register to the Apizee platform. ApiKey is used to isolate your project so you will be able to communicate with users that are registered with the same apiKey.

    ua.register(RegisterInformation(id: [Your user id])) { (error, session) in
        if let error = error {
            showError(error)
            return
        }
        guard let session = session else {
            showError("Session is nil")
            return
        }
        self.session = session
    }

Start communicating

ApiRTC integrate a Contact management to facilitate the communication with other users. Contacts are automatically created on apiRTC depending of user presence or enterprise directory.

When connected, you can start communicating with other connected User Agent in the same Apizee enterprise. As an example, to send a chat message, simply call the Contact#SendMessage() function :

    let userAgentId_2 = "Your contact userId"
    guard let contact = session.getContact(id: userAgentId_2) else {
        showError("Contact is nil")
    }
    contact.sendMessage(message: "Hello") { (error) in
        if let error = error {
            showError(error)
            return
        }
    }

Build your own application

You are now ready to start your own apiRTC based application.

Check our tutorials and API reference to use all our integrated feature.