How can I simulate a button press in Swift iOS8 using code How can I simulate a button press in Swift iOS8 using code swift swift

How can I simulate a button press in Swift iOS8 using code


The Swift translation of:

[buttonObj sendActionsForControlEvents: UIControlEventTouchUpInside];

is:

button.sendActions(for: .touchUpInside)

and it should in fact simulate a button push.


Swift 3

button.sendActions(for: UIControlEvents.touchUpInside)

Swift 4

button.sendActions(for: .touchUpInside)


Try calling your IBAction function:

self.start(self)