Setting up Realm Data as EnvironmentObject?

Hey everyone, with the setup I currently have, I set up an EnvironmentObject for calling some data via a class that retrieves that Realm data. Issue is, I have to reference existing user data (username and password) as I’m not sure how to pass that info from the Login view screen into SceneDelegate. Is there a proper way to setup Realm access/Realm objects as EnvironmentObjects without using a static username/password every time?

This is how it currently looks:

In SceneDelegate

    let contentView = LoginMain(plantsensor: plantsensorlistData[0])
    **var** plantdata = RealmModel()
    window = UIWindow(windowScene: windowScene)
    window?.makeKeyAndVisible()
    window?.rootViewController = UIHostingController(rootView: `contentView.environmentObject(reminders).environmentObject(plantdata))`

RealmModel() is tied to this class, note the static username and password I have to use because the class is called early on in SceneDelegate:

class RealmModel : ObservableObject {
    @Published var plantarray = [Plant]()
    var username = "new"
    var password = "test123"
    init () {
        self.getRealm()
    }
     func getRealm() {
   *All the Realm data is called here*
}