Skip to main content
Get your iOS app connected to social.plus in just a few steps. This guide covers everything from installation to your first authenticated session.

Requirements

  • Xcode 26.0+
  • iOS 14.0+
  • Swift 6.0+

Installation

Initialize the SDK

Create the client with your API key and region so the SDK is ready for authentication.
import AmitySDK

let client = try! AmityClient(apiKey: "YOUR_API_KEY", region: .SG)
This creates the SDK client but does not yet authenticate a user. See Authentication for the next step.

Objective-C Integration

Starting with v6.0.0, AmitySDK for iOS is written in Pure Swift. You can still use it in Objective-C projects by creating a Mixed-Language Project.
We recommend integrating AmitySDK directly into your Objective-C project and using Swift language to call the SDK interfaces for better compatibility and performance.

Mixed Language Project Setup

Create Swift files with necessary interfaces/methods that interact with AmitySDK. These interfaces should be exposed with @objc or @objcMembers attributes. When you add a new Swift file to your Objective-C project, Xcode automatically generates a bridging header file that exposes your Swift code to Objective-C.

Implementation Example

Create a Swift file that wraps AmitySDK functionality:
// SDKLoginManager.swift
// Example of a Swift file which contains a class to interact with AmitySDK

import AmitySDK

class NoopSessionHandler: SessionHandler {
    func sessionWillRenewAccessToken(renewal: any AccessTokenRenewal) {}
}

@objc class SDKLoginManager: NSObject {
    
    let client: AmityClient?
    
    @objc init(apiKey: String) {
        self.client = try? AmityClient(apiKey: apiKey)
    }
    
    @objc func login(userId: String, displayName: String, authToken: String, completion: @escaping (Bool, Error?) -> Void) {
        Task {
            do {
                try await self.client?.login(
                    userId: userId,
                    displayName: displayName.isEmpty ? nil : displayName,
                    authToken: authToken.isEmpty ? nil : authToken,
                    sessionHandler: NoopSessionHandler()
                )
                completion(true, nil)
            } catch {
                completion(false, error)
            }
        }
    }
    
    @objc func logout() {
        Task { try? await self.client?.secureLogout() }
    }
    
    @objc func isLoggedIn() -> Bool {
        guard let state = self.client?.sessionState else { return false }
        if case .established = state { return true }
        return false
    }
    
    @objc func getCurrentUserId() -> String? {
        return self.client?.currentUserId ?? nil
    }
}

Key Considerations

Bridging Header: Xcode automatically creates a bridging header when you add Swift files to an Objective-C project.Import Statement: Use #import "YourProjectName-Swift.h" to access Swift classes in Objective-C.Target Membership: Ensure your Swift files are added to the correct target.
Minimize Bridge Calls: Create comprehensive wrapper methods rather than making frequent cross-language calls.Error Handling: Properly handle Swift optionals and errors in your Objective-C code.Threading: Always dispatch UI updates to the main queue when handling completion callbacks.
Module Not Found: Ensure your project’s module name doesn’t contain special characters or spaces.Swift Version: Make sure your Objective-C project supports the Swift version used by AmitySDK.Linker Errors: Verify that both Objective-C and Swift files are properly linked to your target.

Next Steps

Authentication Guide

Learn about session management and secure authentication flows

Chat Features

Start building chat and messaging features

Social Features

Add posts, feeds, and social interactions

Video Streaming

Implement live video and streaming features

Troubleshooting

Framework not found: Ensure you’ve added all required frameworks and set them to “Embed & Sign”Swift version conflicts: Ensure your project uses Swift 5.0 or later
SDK not initialized: Make sure you call AmityClient.setup(...) in application delegateAuthentication failures: Verify your API key and region settingsPermission denied: Check that required permissions are added to Info.plist
M1 Mac Simulator Issues: Enable Rosetta for your application in Xcode