Saturday, November 21, 2026
HomeiOS Developmentswift - Argument handed to name that takes no arguments IOS SwiftUI

swift – Argument handed to name that takes no arguments IOS SwiftUI

[ad_1]

I making an attempt to name the login perform for person to carry out their login motion, the best way I calling the perform is as observe:

struct LogInView: View {    
    @State  personal var emailAddress: String = ""
    @State  personal var password: String = ""
    @EnvironmentObject var userAuth: UserAuth

    var physique: some View {
    ...
                    Button(motion: {
                        userAuth.login(self.emailAddress, self.password)
                    })
    ...
    }

And beneath is how I declare my login perform

class UserAuth: ObservableObject {
    @Printed var isLoggedIn = false
    var userID = nil {
        didSet {
            didChange.ship(self)
        }
    }
    var UserModel = PersistenceController()
    
    let didChange = PassthroughSubject<UserAuth,By no means>()
    
    // required to adapt to protocol 'ObservableObject'
    let willChange = PassthroughSubject<UserAuth,By no means>()
    
    func login(electronic mail: String, password: String) {
        self.userID = UserModel.loginUser(electronic mail: electronic mail, password: password).id
        self.isLoggedin = true
      }
   }

I’m actually confused, the perform is accepting two parameters, however the error hold displaying “Argument handed to name that takes no arguments”. Anybody is aware of the best way to clear up it? Thanks in Advance.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments