Skip to main content

iOS / iPadOS integration

Swift Package Manager​

Add eduskit-ios in Xcode Package Dependencies and select exact version 0.1.1. The unified release requires iOS 15+.

  • For the supplied classroom interface, link only EduSDKUI.
  • For custom UI, link only EduSDK.

SPM resolves Swift source, the Rust XCFramework, OpenIM, TRTC and DrawsKit. Do not link duplicate provider binaries in the host. The current DrawsKit SPM dependency is 0.1.3, distinct from its Android/npm version.

Host Info.plist​

Add these purpose strings to the host app and adapt them to your product. Package/framework plists do not declare permissions for the host.

<key>NSCameraUsageDescription</key>
<string>Camera access is used for classroom video.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is used for classroom audio.</string>

Swift: present a classroom​

Call on the main thread from a UIViewController, using authenticated entry configuration:

import EduSDKUI

let options = EduClassroomOptions(
appId: appId,
backendUrl: backendUrl,
classroomId: classroomId,
userId: eduUserId,
displayName: displayName,
userToken: accessToken
)
EduClassroomPresenter.present(from: self, options: options)

Objective-C: present a classroom​

#import <EduSDKUI/EduSDKUI-Swift.h>

EduClassroomOptions *options = [[EduClassroomOptions alloc]
initWithAppId:appId
backendUrl:backendUrl
classroomId:classroomId
userId:eduUserId
displayName:displayName
userToken:accessToken
inviteDemoUserId:@"student-demo"
themeMode:EduThemeModeSystem
localeTag:nil];
[EduClassroomPresenter presentFrom:self options:options];

inviteDemoUserId is a demo option; the backend roster determines actual membership. EduClassroomPresenter.preload() can warm dependencies before presentation but does not enter the classroom.

Headless​

import EduSDK

let sdk = EduSdk.create(options: EduSdkCreateOptions(
appId: appId,
backendUrl: backendUrl,
userToken: accessToken
))
sdk.onClassInfoChanged { info in /* render info */ }
sdk.onImMessageReceived { message in /* render message */ }
try sdk.initialize()
try sdk.enterClassroom(params: EnterClassroomParams(
classroomId: classroomId,
userId: eduUserId,
displayName: displayName
))

Retain sdk as a page or session property. Catch method errors and use callbacks for runtime asynchronous results. Call try sdk.leaveClassroom() on exit and sdk.destroy() for final cleanup, including when leave fails. UI Kit manages its own instance.

Callbacks generally run on the main thread. onWhiteboardLiveStrokeReceived runs on the SDK event thread; process and batch high-frequency updates before returning to the main thread.

Source examples and builds​

examples/ios-swift and examples/ios-oc contain host projects. Run make build-ios-xcframework from edu-sdks, then open the Xcode project. make dev-ios also resolves dependencies and builds the example.

Devices use arm64; simulators use arm64/x86_64. Match all binaries to the target architecture. A simulator connecting to a local HTTPS gateway needs to trust its issuing CA. Validate permission denial, background transitions and cleanup using the Integration checks.