Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
古き良きsendAction (in potatotips #26)
tokorom
February 17, 2016
Technology
1
3.2k
古き良きsendAction (in potatotips #26)
UIApplicationのsendActionを見直そう
tokorom
February 17, 2016
Tweet
Share
More Decks by tokorom
See All by tokorom
5分でSharePlay入門
tokorom
2
700
HomeKit 2020
tokorom
7
1.7k
Advanced Segue 2019年のSegue事情
tokorom
10
4.6k
tvOSアプリUIの勘所
tokorom
1
1.3k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
10k
画面遷移と私(iOS)
tokorom
4
3.4k
長生きするために心臓に悪いリリースはもうやめよう
tokorom
22
32k
potatotips#8 Swiftのライブラリを作成/利用しよう
tokorom
7
3.5k
agvtoolで超かっこよくバージョニングできますか?
tokorom
3
27k
Other Decks in Technology
See All in Technology
JAWS-UG 朝会 #33 登壇資料
takakuni
0
350
モデリング、コンテキスト トランジション +1 / Data modeling
ishiayaya
0
110
ここらでGPSマルチユニットが如何に使いやすいか本気で説明するから聞きなさい
mitsuzono
0
330
プロダクション環境の信頼性を損ねず観測する技術
egmc
4
290
~スタートアップの人たちに捧ぐ~ 監視再入門 in AWS
track3jyo
PRO
30
8.2k
キャッチアップ Android 13 / Catch up Android 13
yanzm
1
740
僕の Microsoft Teams (+α) 便利技紹介 2022年春
taichinakamura
0
2.2k
三越伊勢丹の接客DXを支える「DevOps基盤」とは
imdigitallab
0
250
Babylon.js v5 新機能の紹介
limes2018
0
320
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
0
530
The Real MVP: Going from idea to users' hands
adavis
0
550
AWS CLI入門_20220513
suzakiyoshito
0
3.3k
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
237
19k
10 Git Anti Patterns You Should be Aware of
lemiorhan
638
52k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
38
12k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
350
21k
The Invisible Side of Design
smashingmag
289
48k
Three Pipe Problems
jasonvnalue
89
8.6k
KATA
mclloyd
7
8.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
15
900
Done Done
chrislema
174
14k
Designing for humans not robots
tammielis
241
23k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_i
21
14k
Build The Right Thing And Hit Your Dates
maggiecrowley
19
1.1k
Transcript
ݹ͖ྑ͖ sendAction ॴ ༑ଠ @tokorom iOS App Programer potatotips-26
ॴ༑ଠ @tokorom (ϑϦʔλʔʣ potatotipsӡӦ૭ޱ / potatotipsΛओ࠵͍͚ͨͩΔձࣾ͞Μืूதʂ
UIApplication - sendAction
UIApplication - sendAction •࣮ࡍʹ͍ͬͯΔਓͲͷ͘Β͍ʁ •ͦͦଘࡏΛ͍ͬͯΔʁ •ʢUIControlͷ΄͏ͨ·ʹݟΔ͚Ͳ…ʣ •ʢ͍ͬͯΔͷΛ͋Μ·Γݟͨ͜ͱͳ͍ʣ
UIApplication - sendAction NEW! iOS 9 Ͱ ྲྀ ͷ͝ͱ͘ݱΕͨ ࠷ڧ
ͷ function !?
UIApplication - sendAction iPhone OS 2 ͔Β ͘͝ ී௨ ʹଘࡏ͢Δ
͋·Γ ΘΕͳ͍ ͭ
// hoge: ΛൃՐ let app = UIApplication.sharedApplication() app.sendAction("hoge:", to: xxx,
from: sender, forEvent: nil) // hoge: func hoge(sender: AnyObject) { print("hoge!!") } αϯϓϧίʔυ UIApplication - sendAction
UIApplication - sendAction •ग़ͨΑɺจࣈྻࢦఆʂ •Objective-C෩selectorࢦఆ͕ݹष͍ •͍ॴ͋Δͷʁ •RxSwiftͱ͔͏΄͏͕Α͘ͳ͍ʁ app.sendAction("hoge:", to: xxx,
from: sender, forEvent: nil) ͓͓ΉͶ ਖ਼ղ
Responder Chain (in UIKit)
Responder Chain (in UIKit) •Ԟ·ͬͨ֊ͰൃՐ •֊ͷͲ͜Ͱड͚ΒΕΔ •DelegateͷΑ͏ʹreceiverΛड͚ ͢ඞཁ͕ͳ͍ •ଞखஈͰಉ͡ߏΛ࣮ݱ͢Δͷ ͍͠
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)
Responder Chain (in UIKit) UITabBarController UIViewController UITabBarController UIViewController UIViewController UIViewController
Responder Chain (in UIKit) UITabBarController UIViewController UITabBarController UIViewController UIViewController UIViewController
UITableView UITableViewCell UIView UIButton
sendActionͷྑ͍ͱ͜Ζ •Responder Chainͳૄ݁߹ͳΈͰը໘ߏ ͕มΘͬͯར༻Ͱ͖Δ •CocoaͷࠜװͱͳΔΈͷͨΊྲྀߦʹࠨӈ͞ Εͳ͍
sendActionͷμϝͳͱ͜Ζ •ΠϯλʔϑΣʔε͕ݹ͍ •จࣈྻࢦఆ •selector?? •ҾʹಛఆͷObjectΛͮ͠Β͍
৽͍͠ΠϯλʔϑΣʔεͰϥοϐϯά // hoge: ΛൃՐ HogeEvent(hoge: hoge).fireFrom(self.view) // hoge: func hoge(sender:
AnyObject) { guard let hoge: Hoge =ɹContext.valueFor(sender) else { return } print("hoge: \(hoge)") }
·ͱΊ •UIApplicationͷsendAction߹ʹΑͬͯ༗ ༻ •ݹ͖ྑ͖ػೳ͕ͩը໘ߏ͕ෳࡶͳݱͰͦ͜ ར༻Ձ͕͋Δ •ੲ͔Β͋Δػೳʹҙ֎ͱ͑Δͷ͕ͬͯ ͍Δ͔ʁ
More Information Yuta ToKoRo iOS App Programer Twitter @tokorom http://www.tokoro.me/