Coding4Life Coding4Life - 1 year ago 70
Swift Question

Swift : How to click a button programmatically?

I have 2 view controllers which should be swapped according to userinput. So,I want to switch the views programatically based on the input I get from a text file.

Algorithm :
if(input == 1)
Go to View Controller 1
else if(input ==2)
Go to View Controller 2

any help on how to click the button programmatically or load that particular viewcontroller with input!.

Answer Source

To fire an event programmatically you need to call sendActionsForControlEvent