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
【Swift】Protocol 命名 - Convertible
Search
Richard Kao
October 21, 2016
Technology
180
1
Share
【Swift】Protocol 命名 - Convertible
當我們把 protocol 命名為 ”某某Convertible“ 代表了什麼?
是誰轉換成誰?
什麼轉換成什麼?
怎麼應用,來看看
#實習 #公司分享會 #Swift
Richard Kao
October 21, 2016
More Decks by Richard Kao
See All by Richard Kao
【Swift】Extension 的延伸用法
exp50000
0
260
【Swift】在 Protocol extension 內使用 Selector 發生的案例
exp50000
0
120
【Data】我所碰到的 JSON
exp50000
0
54
【iOS】Google Map SDK V.S. MapKit
exp50000
0
100
【iOS】View Hierarchy
exp50000
0
120
【iOS】Auto Layout
exp50000
0
52
【iOS】Clip Subviews
exp50000
0
70
【Swift】 Tutorial Resource
exp50000
0
61
Other Decks in Technology
See All in Technology
AI時代の品質はテストプロセスの作り直し #scrumniigata
kyonmm
PRO
4
1k
コミュニティ・勉強会を作るのは目的じゃない
ohmori_yusuke
0
280
AndroidアプリとCopilot Studioの統合
nakasho
0
200
AI駆動開発で生産性を追いかけたら、行き着いたのは品質とシフトレフトだった
littlehands
0
260
プラットフォームエンジニアリングの実践 - AWS コンテナサービスで構築する社内プラットフォーム / AWS Containers Platform Meetup #1
literalice
1
230
Google Cloud Next '26 の裏でこっそりリリースされたCloud Number Registry & Cloud Hub コスト分析 を試してみた
hikaru1001
0
150
要件定義の精度を高めるための型と生成AIの活用 / Using Types and Generative AI to Improve the Accuracy of Requirements Definition
haru860
0
270
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
7.9k
世界の中心でApp Runnerを叫ぶ FINAL
tsukuboshi
0
200
AIと乗り切った1,500ページ超のヘルプサイト基盤刷新とさらにその先の話
mugi_uno
1
280
QAエンジニアはどうやって プロダクト議論の場に入れるのか?
moritamasami
1
310
多角的な視点から見たAGI
terisuke
0
110
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Done Done
chrislema
186
16k
Faster Mobile Websites
deanohume
310
31k
Code Reviewing Like a Champion
maltzj
528
40k
Skip the Path - Find Your Career Trail
mkilby
1
110
Leo the Paperboy
mayatellez
7
1.7k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
230
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
180
Typedesign – Prime Four
hannesfritz
42
3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Transcript
Convertible
protocol SomeTypeConver t i b l e ‘ Can Be
’
Subject? Object? SomeType can be converted to object Subject can
be converted to SomeType 誰 主 詞 ︖ 誰 受 詞 ︖
Ⰽ罏涼〳腋
• NilLiteralConvertible • BooleanLiteralConvertible • IntegerLiteralConvertible • FloatLiteralConvertible • StringLiteralConvertible
• UnicodeScalarLiteralConvertible • ExtendedGraphemeClusterLiteralConvertible Ex.
protocol IntegerLiteralConvertible { associatedtype IntegerLiteralType init(integerLiteralValue value: Self.IntegerLiteralType) }
Comfort to 以上 Convertible 的型別 可以把 SomeType 轉換成 ᛔ૩ጱࣳ獨
DeMo 程式範例
Ex. Alamofire R o u t e r • URLStringConvertible
• URLRequestConvertible
public protocol URLRequestConvertible { /// The URL request. var URLRequest:
NSMutableURLRequest { get } }
Comfort to 以上 Convertible 的型別 可以把 ᛔ૩ጱࣳ獨 轉換成 SomeType
DeMo 程式範例