Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
古き良きsendAction (in potatotips #26)
Search
tokorom
February 17, 2016
Technology
1
3.6k
古き良きsendAction (in potatotips #26)
UIApplicationのsendActionを見直そう
tokorom
February 17, 2016
Tweet
Share
More Decks by tokorom
See All by tokorom
続・SharePlayの歴史と進化 iOS18とApple Vision Proにおける新展開
tokorom
3
560
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
2
880
5分でSharePlay入門
tokorom
2
1.4k
HomeKit 2020
tokorom
7
2.4k
Advanced Segue 2019年のSegue事情
tokorom
9
5.8k
tvOSアプリUIの勘所
tokorom
1
2k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
12k
画面遷移と私(iOS)
tokorom
4
3.7k
長生きするために心臓に悪いリリースはもうやめよう
tokorom
21
33k
Other Decks in Technology
See All in Technology
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
860
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
380
フルカイテン株式会社 採用資料
fullkaiten
0
40k
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
[FOSS4G 2019 Niigata] AIによる効率的危険斜面抽出システムの開発について
nssv
0
310
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
290
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
170
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
190
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Thoughts on Productivity
jonyablonski
67
4.3k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Side Projects
sachag
452
42k
Music & Morning Musume
bryan
46
6.2k
Writing Fast Ruby
sferik
627
61k
Done Done
chrislema
181
16k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Navigating Team Friction
lara
183
14k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Fireside Chat
paigeccino
34
3k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
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/