New Video Call SDK Framework Analysis
Tags: ios, sdk, videocall
Published: 2022-10-18 04:59:19

## Introduction

ZEGOCLOUD has launched a new [UIKits](https://www.zegocloud.com/developers/uikits) product.

It enables to build within 30 minutes:

1-on-1 video call
group video call
video conference
live streaming
Let’s take iOS Video Call SDK as an example to analyze the UIKits framework to see how it can achieve high scalability and meet various scene functions.

## Getting Started
I would like to analyze the SDK framework in this way:

What is it? What kind of functionality does the SDK provide？
How to use it? What type of interface does the SDK provide？
How to implement it? What structure does the SDK use to implement external functions?
How can I learn from it? What is there for me to learn about the SDK?
Let’s first understand the SDK’s functions through the SDK [overview document](https://docs.zegocloud.com/article/14763).

Learn how to use Video Call SDK according to [Access Documentation](https://docs.zegocloud.com/article/14763).


## 1) **Install SDK**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8yxqcri9gy46o859lwv.png)

After downloading the Sample Code project, there are two folders, call, and group_call, in the project. We take group_call as an example to analyze the project structure. Use Terminal to enter the group_call folder and execute the pod install command to install the dependent video call SDK.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4fotvbhgjo8l88ehin62.png)

**2）Open project**
After executing the pod install command, we can see that there is a ZegoGroupCallDemo.xcworkspace file under the group_call project. Open the file with Xcode, and we can see the complete structure of the project.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kdwtycqujlahsay669tg.png)

**3）Project structure**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tsbkai1mpuwboy18yg1v.jpeg)

**video call sdk**
From the analysis of the Group Call project file, the use of the SDK is extremely simple and needs just 52 lines of code in the ViewController file to complete a Video Call App.

It can be seen from the file structure that the project introduces 4 SDKs.

**2 base SDKs:**

ZIM SDK is responsible for text messaging.
Express SDK is responsible for audio and video data transmission.
2 business layer SDKs:

ZegoUIKit SDK, Closed source SDK.
ZegoUIKitPrebuiltCall SDK, Open source SDK.

**4) SDK structure**
Although ZegoUIKit is a closed-source SDK, by analyzing its interface and the way ZegoUIKitPrebuiltCall uses the interface, the relationship between the 4 SDKs can be inferred.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h64gzmgmskpr3hzzv4eb.png)

As shown in the picture, the video call SDK for iOS is divided into 4 layers:

**Core service layer**
The core layer includes 2 SDKs, ZIM and Express, which provide message transmission and audio and video data transmission.

**Component layer**
ZegoUIKit SDK is an essential part of the whole service. UIKits SDK can adapt to multiple scenes precisely because the component layer abstracts and encapsulates various independent components for audio and video settings, such as:

**Member List component.**
Audio and video-related UI components. (camera, microphone, speaker buttons, video layout, sound waves, etc.)
**Message component.**
Audio and video data management components.
**Business Layer**
ZegoUIKitPrebuiltCall is responsible for the encapsulation of business logic by assembling the components provided by ZegoUIKit. These form the UI of different business scenarios and add the processing logic of interaction events.

Through such simple encapsulation, video calls, video conferences, and live streaming can be created.

Then provide scene-related interface controls ZegoUIKitPrebuiltCallVC and configuration file ZegoUIKitPrebuiltCallConfig; users only need to call the interfaces of these two classes to implement audio and video applications.

**Application layer**
The top layer is the application layer that we need to implement. We only need to display the ZegoUIKitPrebuiltCallVC control when using the Video call function. If there are unique business requirements, it can be done by setting the properties of ZegoUIKitPrebuiltCallConfig.

**## Wrap up**
Through in-depth analysis of UIKits SDK, we understand how it achieves high scalability to meet various scenarios and personalized needs. It can be used for reference in our project development:

Business logic decoupling. Avoid functional components affected by business logic changes.
Module decoupling. Ensure the smallest granularity of operational components and minimize the impact of changes.
Encapsulation remains unchanged, and exposure changes.
You are welcome to interpret the architecture of the video call SDK.