Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ios/TheStream/PrivateChatView.swift:5
struct PrivateChatView: View {
var user: String
var withUser: String
@EnvironmentObject var account: Account
@State var channel: Channel?
@ViewBuilder
var body: some View {
if (channel == nil) {
Text("Loading...").onAppear(perform: loadChannel)
} else {
StreamChatView(channelPresenter: ChannelPresenter(channel: channel!))
.navigationBarTitle("Chat w/ \(withUser)")
}
}
private func loadChannel() {
account.createPrivateChannel(user, withUser) { channel in
self.channel = channel
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.