Created
February 9, 2017 02:22
-
-
Save wh1pch81n/e1feae9e439ce4bfac3b1584cb44ff8e to your computer and use it in GitHub Desktop.
A little extension that lets you "tap" a UIBarButtonItem programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIBarButtonItem { | |
public func programmaticallyTap() { | |
if let target = target | |
, let action = action | |
{ | |
target.value(forKey: NSStringFromSelector(action)) | |
} | |
} | |
} | |
barbutton.programmaticallyTap() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment