Issue with Login logic: No 'async operations occur within 'await' expression

I have 2 problems that I’m running into that I can’t seem to find a solution. I’m new to MongoDB and swift development as a whole.

I’m modelling my login experience off of the current RChat code located at: [RChat/LoginView.swift at 0b12b06d63b9f5dcd5cc4fcc354d7baa187c2adc · realm/RChat · GitHub](https://RChat - Login View)
The first issue is that I’m getting warnings on the app.login saying that "No ‘async’ operations occur within ‘await’ expression
Second, The build fails due to the error “Value of type ‘Future<User, Error>’ (aka ‘Future<RLMUser, Error>’) has no member ‘id’”

I thought this might just be due to some issue in my codebase, but when I pull down Rchat and attempt to build it, I get the same errors. Do I have something configured wrong? Any help would be greatly appreciated!

I noticed I can’t edit my own posts as a new user, so I’m replying to my post to be more clear.

SwiftUI Code that’s giving me issues:

do {
                let user = try await app.login(credentials: .emailPassword(email: email, password: password))
                userID = user.id
                state.shouldIndicateActivity = false
            } catch {
                DispatchQueue.main.async {
                    state.error = error.localizedDescription
                    state.shouldIndicateActivity = false
                }
            }

Main error I’m running in to:

Value of type 'Future<User, Error>' (aka 'Future<RLMUser, Error>') has no member 'id'

Found the solution. I needed to update Xcode from 13.0 to 13.2.1

2 Likes

Hello @Brenton_Mahaffey,

Welcome to the Community :smiley:

Glad to know that you were able to find the resolution for it.

Please feel free to check forums or post a query as needed.

Cheers,
Henna

1 Like

Hi @Brenton_Mahaffey – thanks for pointing this out. I’ll update the Xcode dependency in any articles that refer to the RChat app.

3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.