Upgrade to Pro — share decks privately, control downloads, hide ads and more …

古き良きsendAction (in potatotips #26)

tokorom
February 17, 2016

古き良きsendAction (in potatotips #26)

UIApplicationのsendActionを見直そう

tokorom

February 17, 2016
Tweet

More Decks by tokorom

Other Decks in Technology

Transcript

  1. // hoge: ΛൃՐ let app = UIApplication.sharedApplication() app.sendAction("hoge:", to: xxx,

    from: sender, forEvent: nil) // hoge: func hoge(sender: AnyObject) { print("hoge!!") } αϯϓϧίʔυ UIApplication - sendAction
  2. Responder Chain (in UIKit) app.sendAction("hoge:", to: xxx, from: sender, forEvent:

    nil) app.sendAction("hoge:", to: , from: sender, forEvent: nil) app.sendAction("hoge:", to: nil, from: sender, forEvent: nil)
  3. ৽͍͠ΠϯλʔϑΣʔεͰϥοϐϯά // hoge: ΛൃՐ HogeEvent(hoge: hoge).fireFrom(self.view) // hoge: func hoge(sender:

    AnyObject) { guard let hoge: Hoge =ɹContext.valueFor(sender) else { return } print("hoge: \(hoge)") }