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.

You can do this for the student

Button {
    let docRef = db.collection("login").document("student")

    docRef.getDocument { (document, error) in
        if let document = document, document.exists {
            let dataDescription = document.data().map(String.init(describing:)) ?? "nil"
            print("Document data: \(dataDescription)")
            //Do Other Stuff Here
        } else {
            print("Document does not exist")
        }
    }
}

Button {
    let docRef = db.collection("login").document("instructor")

    docRef.getDocument { (document, error) in
        if let document = document, document.exists {
            let dataDescription = document.data().map(String.init(describing:)) ?? "nil"
            print("Document data: \(dataDescription)")
            //Do Other Stuff Here
        } else {
            print("Document does not exist")
        }
    }
}

Is this what you wanted? If not reply with more detail on what you want because I didn't quite understand. If you want help with firebase. You can go to https://firebase.google.com/docs/firestore/query-data/get-data

How I can access one document in my Firestore Firebase using a button in Swiftui?
 
 
Q