Last active
January 28, 2022 11:09
-
-
Save maxxfrazer/d5cfacc3ba45e174dfe8168787f0075b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import AgoraRtcKit | |
import AgoraUIKit_iOS | |
struct ContentView: View { | |
@State var channelName: String? | |
@State var isShowingVideo: Bool = false | |
var videoCallView: some View { | |
VStack { | |
HStack { /* Other buttons will be placed here */ } | |
ContentView.agview | |
} | |
} | |
static var agview: AgoraViewer = { | |
AgoraViewer( | |
connectionData: AgoraConnectionData( | |
appId: <#Agora App Id#>, rtcToken: <#Agora Token#> | |
), style: .floating | |
) | |
}() | |
var body: some View { | |
NavigationView { | |
ZStack { | |
NavigationLink( | |
destination: self.videoCallView | |
.navigationBarHidden(true) | |
.onAppear(perform: { /* appear action */ }) | |
.onDisappear(perform: { /* disappear action */ }), | |
isActive: $isShowingVideo | |
) { EmptyView() } | |
HStack { | |
Button { | |
self.channelName = "test" | |
self.isShowingVideo = true | |
} label: { | |
Text("Create Channel") | |
.padding().background(.green).cornerRadius(30) | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment