Room Preparation Page | Room Main Page | Member Management |
![]() | ![]() | ![]() |
sudo gem install cocoapods in your terminal.sudo gem install cocoapods, you may be prompted for your computer's password. Enter your administrator password as requested.pod 'TUIRoomKit' to your project's Podfile, such as:target 'YourProjectTarget' do# Other existing pod dependencies...# Add pod 'TUIRoomKit'pod 'TUIRoomKit'end
cd to navigate to your .xcodeproj directory in the terminal, then run pod init to create a Podfile. After creation, add pod 'TUIRoomKit' to the Podfile, for example:// If your project directory is /Users/yourusername/Projects/YourProject// 1. cd to your .xcodeproj project directorycd /Users/yourusername/Projects/YourProject// 2. Run pod init to generate a Podfilepod init// 3. Add pod 'TUIRoomKit' to the generated Podfiletarget 'YourProjectTarget' do# Add pod 'TUIRoomKit'pod 'TUIRoomKit'end
cd to the directory containing your Podfile and run:pod install
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. |
RoomMainView is the primary interface in TUIRoomKit for multi-party audio/video conferencing. The following example shows how to integrate RoomMainView 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.RoomMainView lazily in your controller and set its routerContext property so it can invoke navigation methods via the protocol.RoomMainView as a room owner.viewDidLoad, add RoomMainView 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 RoomMainView from TUIRoomKitprivate lazy var mainView: RoomMainView = {// 3. Configure room entry settingsvar config = ConnectConfig()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 = RoomMainView(roomID: "roomID", behavior: .create(options: options), config: config)view.routerContext = selfreturn view}()public override func viewDidLoad() {super.viewDidLoad()// 5. Add RoomMainView to the view controllerview.addSubview(mainView)mainView.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: create: Room owner creates the room. Requires room creation options.join: Participant joins the room. |
config | ConnectConfig | 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. |
RoomMainView for joining as a participant.RouterContext protocol in your controller.RoomMainView and set its routerContext.RoomMainView 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 RoomMainView from TUIRoomKitprivate lazy var mainView: RoomMainView = {// 3. Configure room entry settingsvar config = ConnectConfig()config.autoEnableCamera = true // Automatically enable cameraconfig.autoEnableMicrophone = true // Automatically enable microphoneconfig.autoEnableSpeaker = true // Automatically enable speaker// 4. Initialize room main page as participantlet view = RoomMainView(roomID: "roomID", behavior: .join, config: config)view.routerContext = selfreturn view}()public override func viewDidLoad() {super.viewDidLoad()// 5. Add RoomMainView to the view controllerview.addSubview(mainView)mainView.snp.makeConstraints { make inmake.edges.equalToSuperview()}}}
RoomMainView, 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.
pod install, CocoaPods will:pod install.pod 'TUIRoomKit', :git => 'https://github.com/your-username/TUIRoomKit.git', :branch => 'your-branch'
RoomMainView 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 RoomMainView to help you make quick adjustments.
RoomMainViewComponent | 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). |
TUIRoomKit.xcassets. Use Xcode's graphical tools to quickly modify custom icons.
Icon | Filename | Description |
![]() | camera_close.png | Camera off icon. |
![]() | camera_open.png | Camera on icon. |
![]() | room_mic_off_red.png | Microphone off icon. |
![]() | room_mic_on_big.png | Microphone on icon. |
![]() | room_admin_tag.png | Administrator badge icon. |
![]() | room_owner_tag.png | Room owner badge icon. |

Podfile.lock and the Pods directory in your project folder. You can do this manually or run:// cd to the directory containing your Podfilerm -rf Pods/rm Podfile.lock
pod install --repo-update in your project directory:// cd to the directory containing your Podfilepod install --repo-update
LoginStore.shared.login once. We recommend linking LoginStore.shared.login and LoginStore.shared.logout with your own authentication logic.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan