古き良きsendAction (in potatotips #26)

0d04162c7a3c2907c059a06dbcd23cf4?s=47 tokorom
February 17, 2016

古き良きsendAction (in potatotips #26)

UIApplicationのsendActionを見直そう

0d04162c7a3c2907c059a06dbcd23cf4?s=128

tokorom

February 17, 2016
Tweet

Transcript

  1. 7.

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

    from: sender, forEvent: nil) // hoge: func hoge(sender: AnyObject) { print("hoge!!") } αϯϓϧίʔυ UIApplication - sendAction
  2. 11.

    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. 16.

    ৽͍͠ΠϯλʔϑΣʔεͰϥοϐϯά // hoge: ΛൃՐ HogeEvent(hoge: hoge).fireFrom(self.view) // hoge: func hoge(sender:

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