Room Preparation Page | Room Main Page | Member Management |
![]() | ![]() | ![]() |
File > Add Package Dependencies.... Paste the following URL into the search box, wait for results, then click Add Package.https://github.com/Tencent-RTC/RoomKit_SwiftPM.git
Choose Package Options ,select the desired released version. See Apple Official Documentation for version selection rules.TUIRoomKit to your App Target. If you use the sample code in this guide, also add the resolved dependencies AtomicXCore and SnapKit to your Target's Frameworks, Libraries, and Embedded Content. No need to add the repository again.sudo gem install cocoapods
pod init to create a Podfile. Edit and save it as follows:platform :ios, '14.0'# Change 'App' to your project's nametarget 'App' dopod 'AtomicXCore', :podspec => 'https://sdk-liteav-1252463788.cos.ap-hongkong.myqcloud.com/app/tuikit/download/latest/AtomicXCore.podspec'# Official default version addresspod 'TUIRoomKit', :podspec => 'https://sdk-liteav-1252463788.cos.ap-hongkong.myqcloud.com/app/tuikit/download/latest/TUIRoomKit.podspec'end
pod install
AtomicXCore; other dependencies are resolved automatically by CocoaPods. After installation, open the .xcworkspace project. The two default version addresses updatndependently. For production, use the paired versioned addresses as described in the FAQs.Info.plist file. These descriptions will be displayed when the system prompts users for permission:<key>NSCameraUsageDescription</key><string>TUIRoomKit requires access to your camera</string><key>NSMicrophoneUsageDescription</key><string>TUIRoomKit requires access to your microphone</string>

didFinishLaunchingWithOptions method. In real-world projects, call the AtomicXCore login service only after your own user authentication and login procedures have completed. This prevents business logic conflicts and ensures seamless integration with your user management and permission systems.import AtomicXCore// AppDelegate.swiftfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {LoginStore.shared.login(sdkAppID: 1400000001, // Replace with your sdkAppIDuserID: "test_001", // Replace with your userIDuserSig: "xxxxxxxxxxx") { result in // Replace with your userSigswitch result {case .success(let info):debugPrint("login success")case .failure(let error):debugPrint("login failed code:\\(error.code), message:\\(error.message)")}}return true}
Parameter | Type | Description |
sdkAppID | Int32 | |
userID | String | Unique user identifier. Use only English letters, numbers, hyphens, and underscores. Avoid using simple IDs like 1 or 123 to prevent multi-device login conflicts. |
userSig | String | Authentication ticket for Tencent Cloud. For development: Use GenerateTestUserSig.genTestSig or the UserSig Assistant Tool for a temporary UserSig.For production: Always generate UserSig server-side to prevent secret key leaks. See Calculating UserSig on the Server. |
setSelfInfo API from LoginStore to set their profile:import AtomicXCorefunc setSelfInfo() {let userProfile = UserProfile(userID: "test_001", // Your logged-in userIDnickname: "tom", // Set nicknameavatarURL: "http://xxx.png") // Set avatar URLLoginStore.shared.setSelfInfo(userProfile: userProfile) { result inswitch result {case .success():debugPrint("setSelfInfo success")case .failure(let error):debugPrint("setSelfInfo failed code:\\(error.code), message:\\(error.message)")}}}
Parameter | Type | Required | Description |
userProfile | UserProfile | Yes | Main user info model: userID: User ID to set. nickname: Nickname. avatarURL: Avatar URL. |
completion | CompletionClosure | No | Callback for the result of setting user info. Returns error code and message if failed. |
MeetingView is the primary interface in TUIRoomKit for multi-party audio/video conferencing. The following example shows how to integrate MeetingView as a room owner.RouterContext protocol to manage page navigation. The host view controller must implement this protocol to handle internal navigation actions such as ending a room or returning to a previous page.MeetingView lazily in your controller and set its routerContext property so it can invoke navigation methods via the protocol.MeetingView as a room owner.viewDidLoad, add MeetingView to your view hierarchy and use constraints to fill the controller's view.UINavigationController methods (push/pop). Ensure your view controller is either the root controller of a UINavigationController or part of its stack. If not, SDK navigation will fail due to the absence of a valid navigation context, resulting in page switching issues.import UIKitimport TUIRoomKitimport SnapKitimport AtomicXCore// YourMainViewController loads the room main page// 1. YourMainViewController must conform to RouterContext in TUIRoomKitclass YourMainViewController: UIViewController, RouterContext {// 2. Lazy load MeetingView from TUIRoomKitprivate lazy var meetingView: MeetingView = {// 3. Configure room entry settingsvar config = RoomConnectConfig()config.autoEnableCamera = true // Automatically enable cameraconfig.autoEnableMicrophone = true // Automatically enable microphoneconfig.autoEnableSpeaker = true // Automatically enable speaker// 4. Initialize room main page as ownervar options = CreateRoomOptions()options.roomName = "roomName" // Set room namelet view = MeetingView(roomID: "roomID", behavior: .createAndJoinRoom(options: options), config: config)view.routerContext = selfreturn view}()public override func viewDidLoad() {super.viewDidLoad()// 5. Add MeetingView to the view controllerview.addSubview(meetingView)meetingView.snp.makeConstraints { make inmake.edges.equalToSuperview()}}}
Parameter | Type | Description |
roomID | String | Unique room identifier. Length: 0–48 bytes. Use only numbers, letters (case-sensitive), underscores (_), and hyphens (-). Avoid spaces and Chinese characters. |
behavior | RoomBehavior | Initialization source: createAndJoinRoom: Room owner creates the room. Requires room creation options. See CreateRoomOptions Struct Details.join: Participant joins the room. |
config | RoomConnectConfig | Audio/video device control configuration after entering the room. |
Parameter | Type | Description |
autoEnableMicrophone | Bool | Automatically enable microphone on room entry. true: Enable automatically (default). false: Do not enable automatically. |
autoEnableCamera | Bool | Automatically enable camera on room entry. true: Enable automatically (default). false: Do not enable automatically. |
autoEnableSpeaker | Bool | Automatically enable speaker on room entry. true: Enable automatically (default). false: Do not enable automatically. |
Parameter Name | Type | Required | Description |
roomName | String | No | Room name (optional, defaults to empty string). Limit: 0-60 bytes. Supports English, Chinese, numbers, special characters. |
password | String | No | Room password. Empty string "" means no password. Limit: 0-32 bytes. Recommend using 4-8 digits for easy mobile input. If set, other users must enter the password to join. Avoid storing plaintext sensitive information. |
isAllMicrophoneDisabled | Bool | No | Disable microphones for all members. When enabled, only host/admin can unmute; regular participants are muted by default. true: Disabled. false: Not disabled (default). |
isAllCameraDisabled | Bool | No | Disable cameras for all members. When enabled, only host/admin can enable cameras; regular participants are disabled by default. true: Disabled. false: Not disabled (default). |
isAllScreenShareDisabled | Bool | No | Disable screen sharing for all members. When enabled, only host/admin can share screen. true: Disabled. false: Not disabled (default). |
isAllMessageDisabled | Bool | No | Disable chat messages for all members (mute). When enabled, regular participants cannot send text messages in the room. true: Disabled. false: Not disabled (default). |
MeetingView for joining as a participant.RouterContext protocol in your controller.MeetingView and set its routerContext.MeetingView and set constraints.import UIKitimport TUIRoomKitimport SnapKitimport AtomicXCore// YourMainViewController loads the room main page// 1. YourMainViewController must conform to RouterContext in TUIRoomKitclass YourMainViewController: UIViewController, RouterContext {// 2. Lazy load MeetingView from TUIRoomKitprivate lazy var meetingView: MeetingView = {// 3. Configure room entry settingsvar config = RoomConnectConfig()config.autoEnableCamera = true // Automatically enable cameraconfig.autoEnableMicrophone = true // Automatically enable microphoneconfig.autoEnableSpeaker = true // Automatically enable speaker// 4. Initialize room main page as participantlet view = MeetingView(roomID: "roomID", behavior: .join, config: config)view.routerContext = selfreturn view}()public override func viewDidLoad() {super.viewDidLoad()// 5. Add MeetingView to the view controllerview.addSubview(meetingView)meetingView.snp.makeConstraints { make inmake.edges.equalToSuperview()}}}
MeetingView, your application will offer a full-featured multi-party audio/video conference interface, including member management, device controls, room information display, and more. This is the central functionality of TUIRoomKit.
TUIRoomKit.podspec and import via :path. The SwiftPM wrapper repository cannot be used directly as a CocoaPods local dependency.MeetingView main page is highly customizable. You can modify the UI to fit your product requirements and interaction scenarios. The following overview details the view components within MeetingView to help you make quick adjustments.
MeetingViewComponent | Feature Description | Customization Suggestions |
Main room container, coordinates layout and data among subcomponents. | Adjust background, safe area handling, component visibility logic. | |
Top navigation bar with room info, camera/audio controls, and exit button. | Replace icons, tweak background transparency, add custom buttons (e.g., recording, window mode). | |
Video stream area, waterfall layout for multiple users. | Change layout (rows, columns, spacing), customize page indicator, design empty state views. | |
User video cell with screen and basic info. | Customize video rendering, user info (avatar, badge), add interactive controls (voice waveform). | |
Bottom toolbar for microphone, camera, and member management. | Rearrange buttons, modify styles (color, size), add business features (screen sharing, in-meeting call, beauty filter). |
TUIRoomKitIcons.xcassets. Use Xcode's graphical tools to quickly modify custom icons.
Icon | Filename | Description |
| roomkit_icon_camera_off.svg | Camera off icon. |
| roomkit_icon_camera.svg | Camera on icon. |
| roomkit_icon_microphone_off.svg | Microphone off icon. |
| roomkit_icon_microphone.svg | Microphone on icon. |
| roomkit_icon_screen_share.svg | Room owner badge icon. |

SwiftPM: In Xcode's Package Dependencies, select the released version and use Exact Version to lock the version.External Pods: Replace the two default addresses with paired versioned podspec addresses. ROOM_VERSION and CORE_VERSION are component versions; ROOM_MAJOR_MINOR and CORE_MAJOR_MINOR are the first two segments of each version number. Replace accordingly; do not assume both components share the same version number.pod 'AtomicXCore', :podspec => 'https://sdk-liteav-1252463788.cos.ap-hongkong.myqcloud.com/app/tuikit/download/release/CORE_MAJOR_MINOR/AtomicXCore_CORE_VERSION.podspec'pod 'TUIRoomKit', :podspec => 'https://sdk-liteav-1252463788.cos.ap-hongkong.myqcloud.com/app/tuikit/download/release/ROOM_MAJOR_MINOR/TUIRoomKit_ROOM_VERSION.podspec'
pod update TUIRoomKit AtomicXCore
pod install typically retains the version in Podfile.lock and does not upgrade proactively. Submit the updated Podfile.lock; do not delete the entire lock file to upgrade the SDK.Resolve Package Versions in File > Packages. If it still fails, try Reset Package Caches.TUIRoomKit, AtomicXCore, SnapKit. For CocoaPods, confirm both podspecs are added and open the project via .xcworkspace.TUIRoomKit. If needed, use the paired versioned address.LoginStore.shared.login once. It's best to tie login and logout to your own authentication logic.ROOM_VERSION with the released version, and add to your package's dependencies:.package(url: "https://github.com/Tencent-RTC/RoomKit_SwiftPM.git", from: "ROOM_VERSION")
.product(name: "TUIRoomKit", package: "RoomKit_SwiftPM")
package: uses the package identity RoomKit_SwiftPM, not the module name TUIRoomKit. If your business code directly imports AtomicXCore or SnapKit, declare their repository dependencies in your package manifest and add their product names to the target. Version requirements should match the Package.swift under your selected RoomKit_SwiftPM tag.피드백