I have 4 buttons that call one function. Depending on which button was pressed i need to hide button inside of function that called after pressing.I dont know which button w
Rather then using a switch statement you can just use the sender directly.
Note that you need to specify that the sender is a UIButton (therefore this will only work if the function is only called from a button).
@IBAction func submitButton(sender: UIButton) {
/* extra code here */
sender.enabled = false
}
This reduces the code and also allows you to add extra buttons without code changes.