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
610
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
3
900
5分でSharePlay入門
tokorom
3
1.4k
HomeKit 2020
tokorom
7
2.5k
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
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
180
Wantedly での Datadog 活用事例
bgpat
1
410
CustomCopを使ってMongoidのコーディングルールを整えてみた
jinoketani
0
220
アップデート紹介:AWS Data Transfer Terminal
stknohg
PRO
0
170
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
非機能品質を作り込むための実践アーキテクチャ
knih
2
660
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
360
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
OpenShift Virtualizationのネットワーク構成を真剣に考えてみた/OpenShift Virtualization's Network Configuration
tnk4on
0
130
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Building Applications with DynamoDB
mza
91
6.1k
Typedesign – Prime Four
hannesfritz
40
2.4k
The Cult of Friendly URLs
andyhume
78
6.1k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Site-Speed That Sticks
csswizardry
2
190
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Fireside Chat
paigeccino
34
3.1k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
KATA
mclloyd
29
14k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
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/