I have created a UIActionSheet
UIActionSheet * action = [[UIActionSheet alloc]initWithTitle:@\"\"
Not knowing the current bar button item action you can invoke it this way:
[barButtonItem.target performSelector:barButtonItem.action]
This will however bring "unknown selector" compiler warning, but this may be worked around.
For my case with RxCocoa I needed to provide a nil - object
to the perform action otherwise it would crash with EXC_BAD_ACCESS
:
let button = sut.navigationItem.leftBarButtonItem!
_ = button.target?.perform(button.action, with: nil)