Skip to content

Instantly share code, notes, and snippets.

@nparsons08

nparsons08/ChannelsView.swift Secret

Created May 4, 2020
Embed
What would you like to do?
// ios/TheStream/ChannelsView.swift:5
struct ChannelsView: View {
@EnvironmentObject var account: Account
@State var channelName: String = ""
private var channelsPresenter: ChannelsPresenter = ChannelsPresenter(filter: .in("type", ["livestream"]))
var body: some View {
VStack {
HStack() {
TextField("Start new channel...", text: $channelName, onCommit: createChannel)
Button(action: createChannel) { Text("Create") }
}.padding()
StreamChannelsView(
channelsPresenter: channelsPresenter
)
}
}
private func createChannel() {
if (!channelName.isBlank) {
account.createPublicChannel(channelName) { channel in
self.channelName = ""
self.channelsPresenter.reload()
}
}
}
}
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.