Contents

AgoraIO-Community/SwiftUIRtc

SwiftUI and Real-time Video Calling with Agora's RTC SDK

Requirements

Installation

SwiftUIRtc can be installed using Swift Package Manager in Xcode. Simply add the package to your project by navigating to File > Swift Packages > Add Package Dependency and entering the repository URL:

https://github.com/AgoraIO-Community/SwiftUIRtc.git

Usage

To use SwiftUIRtc in your SwiftUI project, simply import the package and use the provided views and classes. For example, you can use AgoraVideoCanvasView and AgoraManager view to render all the video streams in an Agora RTC session:

import SwiftUIRtc
import AgoraRtcKit

struct AgoraGettingStartedView: View {
    @ObservedObject var agoraManager = AgoraManager(appId: <#AppId#>, role: .broadcaster)
    var channelId: String = "test"
    var body: some View {
        ScrollView {
            VStack {
                ForEach(Array(agoraManager.allUsers), id: \.self) { uid in
                    AgoraVideoCanvasView(manager: agoraManager, canvasId: .userId(uid))
                        .aspectRatio(contentMode: .fit).cornerRadius(10)
                }
            }.padding(20)
        }.onAppear {
            agoraManager.agoraEngine.joinChannel(
                byToken: <#Agora Temp Token#>, channelId: channelId, info: nil, uid: 0
            )
        }.onDisappear {
            agoraManager.agoraEngine.leaveChannel()
        }
    }
}

Contributing

Contributions to SwiftUIRtc are welcome! If you encounter any issues or have feature requests, please submit an issue on the GitHub repository. Pull requests are also welcome.

License

SwiftUIRtc is available under the MIT license. See the LICENSE file for more information.

Acknowledgments

SwiftUIRtc relies on the AgoraRtcKit framework developed by Agora.io for real-time communication functionality.

Package Metadata

Repository: AgoraIO-Community/SwiftUIRtc

Homepage: https://agoraio-community.github.io/SwiftUIRtc/

Stars: 9

Forks: 5

Open issues: 0

Default branch: main

Primary language: swift

License: MIT

Topics: agora, real-time, real-time-video-streaming, rtc, rte, swiftui, video-call, video-streaming

README: README.md