I want to add another events when the button is clicked. i use addTarget to observe the button when is clicked and call a method name showModal. see the code below.
headerView.addTaskButton.addTarget(self, action: #selector(showModal), for: .touchUpInside)
and i want to add another action when that button is pressed. but i don’t know where.
self.todoListViewModel.updateMode(.edit)
is there any way to do it with addTarget? like adding closure and stuff?
- I want only addTaskButton to update the mode.
if i added
self.todoListViewModel.updateMode(.edit)
in showModal method, everything calling that method will be updated the mode as .edit
so i don’t want to put that in showModal method. is there anyway?