Post

Replies

Boosts

Views

Activity

Login Auth using firebase with different collections and documents in SwiftUI
I have two collections in Firestore (Instructor, Student), and each collection has a bunch of documents. How can I access each document with the Auth method? And I have two buttons: (Log in as Student, Log in as Instructor). I want each button to access the collection and the wanted document. Button1: Log in as Student -> "Student" collection. Button2: Log in as Instructor -> "Instructor" collection.
0
0
238
May ’22
How I can access one document in my Firestore Firebase using a button in Swiftui?
Recently I created a Swiftui project and connected it with my firestore firebase, and I have two documents (Student, Instructor). And in my project, I have two buttons (Login as Student, log in as Instructor), how can I connect the two buttons to fit with these documents respectively? In summary, the "Login as Student" button should ONLY access the "Student" document, and the "Log in as Instructor" button should ONLY access the "Instructor" document.
1
0
949
Apr ’22
Error in Firestore Firebase while running swiftui app
I built a registration page in Swiftui with 8 text fields and connected it successfully with Firestore Firebase. The problem is, I have declared many conditionals for: The user must check the password strength before pressing the "Register Button". If one of the fields is empty, this will occur an error. The password and re-password must be matched. If nothing is wrong, the user should see that he/she successfully registered. After registering, the fields should be empty. The button declaration: Button(action: {             alertPresented.toggle()               //            //Text Fields //            firstName = "" //            lastName = "" //            email = "" //            password = "" //            phoneNum = "" //            studentID = "" //            coursesNum = "" //            repassword = "" //            //After checking the strength //            passwordStatus = ""           }) {             Text("Register")           }           .padding(12)           .frame(width: UIScreen.main.bounds.width - 150)           .background(Color("Color"))           .foregroundColor(.white)           .cornerRadius(8)           .alert(isPresented: $alertPresented, content: {             getAlerts()           })         } The getAlerts function: func getAlerts() -> Alert {           if self.password != self.repassword {       return Alert(title: Text("Error!"), message: Text("The passwords NOT matching"), dismissButton: .default(Text("OK!")))     }           if (self.firstName == "") && (self.lastName == "") && (self.email == "") && (self.password == "") && (self.repassword == "") && (self.studentID == "") && (self.phoneNum == "") && (self.coursesNum == "") {       return Alert(title: Text("Error!"), message: Text("Something MISSING!"), dismissButton: .default(Text("Got it!")))     }           if self.passwordStatus == "Weak" {       return Alert(title: Text("Error!"), message: Text("You can't register if the password is WEAK!"), dismissButton: .default(Text("Got it!")))     }           if trigger == 0 {       return Alert(title: Text("Error!"), message: Text("Please check the strength first"), dismissButton: .default(Text("Got it!")))     } else {       data.addData(firstName: firstName, lastName: lastName, email: email, password: password, phoneNum: phoneNum, studentID: studentID, coursesNum: coursesNum)       return Alert(title: Text("Congrats!!"), message: Text("You successfully REGISTERED, you can go back to Login"), dismissButton: .default(Text("Awesome!!")))     }   } The problem is when everything is correct and I press the Register button, I got more than 5 documents in Firestore, and the "Something Missing" alert shows, and the fields went empty.
0
0
389
Apr ’22
Generating .onDelete on my list
I'm using a list with a navigation link in my swiftui app, and I'm not using a ForEach loop and trying to put the ".onDelete "method but I don't know how can I do that. Can you help me? NavigationView {       List(courses) {course in         NavigationLink(destination: CourseDetails(course: course)) {           StudentExtractedCourses(course: course)         }       }     }
2
0
995
Apr ’22
Building a new IOS app
I am trying to build a new ios app (Clicker), which is an educational app for universities. I want to build it using SwiftUI NOT Storyboard, and its features are: Login and register with Firebase. Students can put their attendance when they are asked by the instructor. The instructor can make a pop quiz, and he/she can choose the quiz type: Multiple Choice/Polls/Yes or No. The quiz results will be shown on the instructor's account. And other features. So, what should I learn to make a progress with it? If something is not clear, please reply to this question.
1
0
457
Apr ’22