I connected a function, which contains an if and else statement, to a button; but I also want to add another action that the button executes only when it is pressed for the first time, i.e. I only want it to perform the if-else when it's tapped for a second, third etc. time.
First, extract your logic into separate function - it will be easier for you to manage it.
Second, add boolean to the controller called firstTimePressed
:
var firstTimePressed : Bool = false
in your button action add the following:
if(firstTimePressed == false){
firstTimePressed = true
}
else{
//call your function
}
And that's it.