ZEGOCLOUD no longer classifies environments into production environments and testing environments.
If you create your project in ZEGOCLOUD Admin Console on/before 2021-11-16, refer to the Testing environment deprecation to upgrade the SDK and adjust related codes.
This sample source code supports iOS and macOS platforms. The requirements for the development environment are relatively high.
The source code of this sample uses SwiftUI to build the interface. To learn more about the environment requirements of the ZegoExpress SDK, please refer to Quick Starts-Integration.
Before you attempt to run the sample source code, make sure that the development environment meets the following requirements:
Go to ZEGOCLOUD Admin Console to create a new project, and get the AppID and AppSign of your project.
The SDK now also supports using Token for authentication, if you want to change your authentication mode, refer to the Guide for upgrading the authentication mode from using the AppSign to Token.
The following directory structure is the file structure of the apple_swift
subdirectory, and the file paths mentioned below are all relative to this directory.
.
├─ .gitignore
├─ DownloadSDK.sh
├─ README.md
├─ README_zh.md
├─ Shared
│ ├─ Assets.xcassets
│ ├─ Deps
│ ├─ Helper
│ ├─ HomePage # Home page
│ ├─ KeyCenter.swift # Fill in the AppID and AppSign of the application
│ ├─ SampleCode.xcconfig
│ ├─ SupportingViews
│ ├─ Topics # The corresponding function module pages on the interface
│ │ ├─ PlayStream
│ │ ├─ PublishStream
│ │ ├─ QuickStart
│ │ ├─ SoundLevel
│ │ └─ VideoTalk
│ └─ ZegoExpressExampleApp.swift
├─ Tests Shared
│ ├─ TestEngineModule.swift
│ └─ TestRoomModule.swift
├─ Tests iOS
│ ├─ Info.plist
│ └─ Tests_iOS.swift
├─ Tests macOS
│ ├─ Info.plist
│ └─ Tests_macOS.swift
├─ VERSION.txt
├─ ZegoExpressExample.xcodeproj # Swift project files
├─ iOS
│ ├─ Info.plist
│ ├─ Libs # ZegoExpressVideo iOS SDK storage directory
│ ├─ README.md
│ └─ iOS.entitlements
└─ macOS
├─ Info.plist
├─ Libs # ZegoExpressVideo Mac SDK storage directory
├─ README.md
└─ macOS.entitlements
ZegoExpressExample.xcodeproj
file by using Xcode.a. Open Xcode and select File > Open... in the upper-left corner.
b. Select the ZegoExpressExample.xcodeproj
file in the uncompressed sample source code folder and open it.
a. Select Xcode > Preference in the upper-left corner of Xcode.
b. After you click the Account tab, click the plus (+) icon in the lower-left corner, select Add an Apple ID, and click Continue.
c. Enter your Apple ID and password to log in.
a. In Xcode, click the "ZegoExpressExample" project on the left.
b. Click the Signing & Capabilities tab and select the developer certificate in Team.
The source code in this sample adaptively obtains TeamID as the suffix of the Bundle identifier, and developers do not need to modify it manually.
The downloaded sample source code lacks the AppID and AppSign required for SDK initialization. You need to modify the KeyCenter.swift
file in the Shared
directory. Please use the AppID and AppSign obtained in the Prerequisites to fill in the information correctly. Otherwise, the sample source code cannot run properly.
Connect the iOS device to the development computer, click Generic iOS Device in the upper-left corner of Xcode, and select the iOS device or simulator.
We recommend you run your project on a real device. If your app runs successfully, you should hear the sound and see the video captured locally from your device.
To test out the real-time audio and video features, visit the ZEGO Express Web Demo, and enter the same AppID
, Server
and RoomID
to join the same room. If it runs successfully, you should be able to view the video from both the local side and the remote side, and hear the sound from both sides as well.
In audio-only scenarios, no video will be captured and displayed.