Why it says "Function is unused" in SwiftUI?

I have SwiftUI project, and I want to use register for my project, it throw an error as a "Function is unused" for signUp in this line of code:

            Button {
                  self.viewModel.signUp   
                } label: {
                  Text("Register")
                    .padding()
                }

I do not know why?

struct Register: View {
   
  @ObservedObject private var viewModel: RegisterViewModel
  @State var pushActive = false
    
   init(state: AppState) {
      
   self.viewModel = RegisterViewModel(authAPI: AuthService(), state: state)
      
   }
 
  var body: some View {
   Button {
          
                  self.viewModel.signUp
                   
                } label: {
                  Text("Register")
                    .padding()
                   
                }
  }

viewmodel:

class RegisterViewModel: ObservableObject {
  @Published var email: String = ""
  @Published var password: String = ""

  @Published var state: AppState
   
  private var cancellableBag = Set<AnyCancellable>()
  private let authAPI: AuthAPI
   
  init(authAPI: AuthAPI, state: AppState) {
    self.authAPI = authAPI
    self.state = state
  }
   
  func signUp() {
    authAPI.signUp(email: email, password: password)
      .receive(on: RunLoop.main)
      .map(resultMapper)
      .store(in: &cancellableBag)
  }
}

}
Answered by skysoft13 in 706407022

I forget put the () end of the signUp   

    self.viewModel.signUp()
Accepted Answer

I forget put the () end of the signUp   

    self.viewModel.signUp()
Why it says "Function is unused" in SwiftUI?
 
 
Q