title: Argument passed to call that takes no arguments IOS SwiftUI
body: <p>I trying to call the login function for user to perform their login action, the way I calling the function is as follow:</p>
  <pre><code>struct LogInView: View {    
      @State  private var emailAddress: String = &quot;&quot;
      @State  private var password: String = &quot;&quot;
      @EnvironmentObject var userAuth: UserAuth
  
      var body: some View {
      ...
        Button(action: {
                      userAuth.login(self.emailAddress, self.password)
                  }) {
                         HStack {
                             Text(&quot;Sign In as Owner&quot;)
                         }
                             .padding()
                             .frame(width: geometry.size.width - 40, height: 40)
                             .foregroundColor(Color.white)
                             .background(Color.blue)
                             .cornerRadius(5)
                     }
      ...
      }
  </code></pre>
  <p>And below is how I declare my login function</p>
  <pre><code>class UserAuth: ObservableObject {
      @Published var isLoggedIn = false
      var userID = nil {
          didSet {
              didChange.send(self)
          }
      }
      var UserModel = PersistenceController()
      
      let didChange = PassthroughSubject&lt;UserAuth,Never&gt;()
      
      // required to conform to protocol 'ObservableObject'
      let willChange = PassthroughSubject&lt;UserAuth,Never&gt;()
      
      func login(email: String, password: String) {
          self.userID = UserModel.loginUser(email: email, password: password).id
          self.isLoggedin = true
        }
     }
  </code></pre>
  <p>I am really confused, the function is accepting two parameters, but the error keep showing &quot;Argument passed to call that takes no arguments&quot;. Anyone knows how to solve it? Thanks in Advance.</p>