# Enter Waiting Room Flow URL: https://developers.vsee.com/guides/clinickit/enter-waiting-room - [For patients](#for-patients) - [For guest patients](#for-guest-patients) These flows use the VSeeClinicCore framework (iOS). For Android, see the [Android Enter Waiting Room Flow](https://developers.vsee.com/guides/clinickit/android-enter-waiting-room). ### For patients A user logs in and, once logged in, enters the waiting room. #### Preconditions - The user has a valid username and password. - The user must be logged in to enter the waiting room. #### Use case steps 1. **User login:** the app starts the login by calling `userLogin` with the user's username and password. ```swift public func userLogin(userName: String, password: String, success: @escaping() -> Void, failure: @escaping (Error) -> Void) { // Perform the login process with the provided username and password. } ``` ![Login](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/login.png) 2. **User authentication:** the `userLogin` API authenticates the user with the backend server. 3. **Login success:** if authentication succeeds, the `success` closure passed to `userLogin` runs, and the user is logged in. ![Login success](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/login-success.png) 4. **Login failure:** if authentication fails because of wrong credentials or any other reason, the `failure` closure runs with an `Error` object, so the app can handle the failure gracefully. ![Login failure](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/login-failure.png) 5. **Initialize intake information:** after login, the app creates an `IntakeConfig` with the reason for the visit. ```swift let intakeConfig = IntakeConfig(reasonForVisit: "Routine check-up") ``` ![Intake](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/intake.png) 6. **Start the visit in the native view (VSeeKit):** the app starts the visit in the VSeeKit native view by calling `startVisitByNativeView` with the intake configuration. ```swift VSeeKit.shared.startVisitByNativeView(with: intakeConfig, success: { // Handle successful start of the visit using VSeeKit native view. }, failure: { error in // Handle the failure to start the visit using VSeeKit native view. }) ``` 7. **Start the visit in a web browser:** alternatively, the app can start the visit in a web browser by calling `startVisitByBrowser` with the intake configuration. ```swift VSeeKit.shared.startVisitByBrowser(with: intakeConfig, success: { // Handle successful start of the visit using the web browser. }, failure: { error in // Handle the failure to start the visit using the web browser. }) ``` ![Start visit](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/start-visit.png) #### Error handling If login fails, inspect the `Error` object passed to the `failure` closure of `userLogin`. Likewise, failures when starting the visit with VSeeKit or the web browser are passed to the `failure` closure of those functions. Show a suitable error message or take action based on the type of error. #### Conclusion This flow shows VSeeClinicCore integrated into an app: follow the steps and handle errors, and logged-in users can enter the waiting room and start their visit smoothly. ### For guest patients A guest user enters the waiting room without logging in. Instead, the guest gives their first name, last name, and date of birth (DOB). The flow initializes the guest user, collects their details, and starts the visit with VSeeClinicCore. #### Use case steps 1. **Initialize the guest user:** the app calls `guestLogin` with the guest's first name, last name, and date of birth. ![Guest details](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/guest-info.png) ```swift public func guestLogin(_ firstName: String, lastName: String, dob: String, success: @escaping() -> Void, failure: @escaping (Error) -> Void) { // Initialize the guest user with the provided first name, last name, and DOB. } ``` ![Guest login](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/guest-intake.png) 2. **Initialize intake information:** after the guest user is initialized, the app creates an `IntakeConfig` with the reason for the visit and the guest's first name, last name, and date of birth. ```swift let intakeConfig = IntakeConfig(reasonForVisit: "Routine check-up", firstName: firstName, lastName: lastName, dob: dob) ``` ![Intake](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/intake.png) 3. **Start the visit in the native view (VSeeKit):** the app starts the visit in the VSeeKit native view by calling `startVisitByNativeView` with the intake configuration. ```swift VSeeKit.shared.startVisitByNativeView(with: intakeConfig, success: { // Handle successful start of the visit using VSeeKit native view. }, failure: { error in // Handle the failure to start the visit using VSeeKit native view. }) ``` 4. **Start the visit in a web browser:** alternatively, the app can start the visit in a web browser by calling `startVisitByBrowser` with the intake configuration. ```swift VSeeKit.shared.startVisitByBrowser(with: intakeConfig, success: { // Handle successful start of the visit using the web browser. }, failure: { error in // Handle the failure to start the visit using the web browser. }) ``` ![Start visit](https://developers.vsee.com/images/guides/clinickit/enter-waiting-room/start-visit.png) #### Error handling If guest initialization or starting the visit fails, handle the `Error` object: show an error message or take action based on the type of error. #### Conclusion This flow lets guest users enter the waiting room and start their visit without logging in. ### Try the API calls interactively The [Video Session](https://developers.vsee.com/use-cases/patient-video-session) use case walks through the same flow with live API calls.