Skip to content

Instantly share code, notes, and snippets.

@conscientiousness
Last active August 11, 2016 08:30
Show Gist options
  • Save conscientiousness/b090ea70af873e66cdfdb71d045e0122 to your computer and use it in GitHub Desktop.
Save conscientiousness/b090ea70af873e66cdfdb71d045e0122 to your computer and use it in GitHub Desktop.
extension Selector
// in self class -> MyVC
myBtn.addTarget(self, action: .selfSelector, forControlEvents: .TouchUpInside)
// in singleton class -> mainVC
mainVCBtn.addTarget(SingletonClass.shared().mainVC, action: .addTopicSelector, forControlEvents: .TouchUpInside)
private extension Selector {
static let selfSelector = #selector(MyVC.btnDidPressed(_:))
static let addTopicSelector = #selector(SingletonClass.shared().mainVC.newTopicBtnPressed(_:))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment