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.4k
古き良きsendAction (in potatotips #26)
UIApplicationのsendActionを見直そう
tokorom
February 17, 2016
Tweet
Share
More Decks by tokorom
See All by tokorom
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
2
630
5分でSharePlay入門
tokorom
2
1.3k
HomeKit 2020
tokorom
7
2.2k
Advanced Segue 2019年のSegue事情
tokorom
9
5.4k
tvOSアプリUIの勘所
tokorom
1
1.8k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
12k
画面遷移と私(iOS)
tokorom
4
3.6k
長生きするために心臓に悪いリリースはもうやめよう
tokorom
22
33k
potatotips#8 Swiftのライブラリを作成/利用しよう
tokorom
7
3.6k
Other Decks in Technology
See All in Technology
LLMプロダクト事業の立ち上げにおける挑戦
layerx
PRO
7
1.5k
AMLD 2024 - Build Your Own GPT
donlelef
1
260
私のRSpecの書き方 / How I write RSpec
tmtms
4
840
10分でわかるfreeeのQA
freee
0
260
単回帰分析について数式を追いながら実装してみた
kentaitakura
0
510
オーティファイ会社紹介資料 / Autify Company Deck
autifyhq
7
100k
技術イベントはなんとかひねり出す 日経の技術広報の取り組み/techpr3
nishiuma
0
230
やっていきテスト
k6s4i53rx
0
160
ビジネスとコード品質の接合点 そしてコード品質がそこに及ぼす影響 / The Intersections of Business and Engineering, and The Impact of Code Quality There
mtx2s
11
1.1k
KubeCon EU: Unlocking new Platform Experiences with Open Interfaces
salaboy
1
380
Vos logs méritent mieux que la config par défaut
lyrixx
2
440
これまでのキャリアとこれからMLエンジニアとしてどう動くか
masatakashiwagi
1
790
Featured
See All Featured
BBQ
matthewcrist
78
8.7k
Happy Clients
brianwarren
91
6.3k
Documentation Writing (for coders)
carmenintech
59
3.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
319
20k
Designing Experiences People Love
moore
135
23k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.4k
Building a Scalable Design System with Sketch
lauravandoore
455
32k
Debugging Ruby Performance
tmm1
68
11k
The World Runs on Bad Software
bkeepers
PRO
60
6.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
257
12k
How to train your dragon (web standard)
notwaldorf
71
5.1k
Optimising Largest Contentful Paint
csswizardry
7
2.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/