I'm facing an issus with the Firebase Snapshot. I conntected my Fierbase account succesfully with my Xcode project. I am capable to change data in my Firestore cloud. But I can't read it. Here is my function:
class UserService{
static func CheckIfMoreThanOneUserIsLoggedIn() -> Bool{
    var BoolenToReturn:Bool?
    let AuthUser = Auth.auth().currentUser
    let userId = AuthUser!.uid
    let localDeviceString = Constants.UserDefaultsStorage.string(forKey: userId)
    // LocalDeviceString is generated (20 random letters) when the user is logged in succesfully.
    //This DeviceString would be stored on one hand in the cloud on the other hand on the device.
    //When the user open the Application it checks if the localDeviceString of the cloud is the same as the String stored on the device.
    //I’m able to denie the user access through multiple devices simultaneously (-> Any imporvent is desired)
    let newUserReference = Firestore.firestore().collection("users").document(userId)
    newUserReference.getDocument {
        (querySnapshot, err) in // Code never runs the closure
        guard err != nil else {
            return
        }
        for document in querySnapshot!.data()! {
            if document.key == "RandomString" {
                let docValue:String = document.value as! String
                if docValue == localDeviceString{
                    BoolenToReturn = true
                }
                else{
                    BoolenToReturn = false
                }
            }
        }
    }
    return BoolenToReturn  ?? false
}
}
Edit
Based on @Frank van Puffelen's links I was able to make my own solution. But the program isn't as professional as I want because now it is a function defined in the LaunchViewController. In addition I'm calling the segue to the HomeViewController in the closure of newUserReference.getDocument . What I wan't to achieve: A function that is defined in the UserService Class which returns a bool if the user is allowed to use the app.