Skip to content

Instantly share code, notes, and snippets.


cardoso/LoginView.swift Secret

Created May 17, 2020
What would you like to do?
import SwiftUI
import StreamChatClient
struct LoginView: View {
private var username: String = ""
private var success: Bool?
var body: some View {
VStack {
TextField("Type username", text: $username).padding()
NavigationLink(destination: ChatView(), tag: true, selection: $success) {
Button(action: logIn) {
Text("Log in")
.frame(maxHeight: .infinity, alignment: .top)
.navigationBarTitle("Log in", displayMode: .inline)
func logIn() {
Client.shared.set(user: User(id: username), token: .development) { result in
switch result {
case .success:
self.success = true
case .failure:
self.success = false
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.