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
1
170
【Swift】Protocol 命名 - Convertible
當我們把 protocol 命名為 ”某某Convertible“ 代表了什麼?
是誰轉換成誰?
什麼轉換成什麼?
怎麼應用,來看看
#實習 #公司分享會 #Swift
Richard Kao
October 21, 2016
Tweet
Share
More Decks by Richard Kao
See All by Richard Kao
【Swift】Extension 的延伸用法
exp50000
0
250
【Swift】在 Protocol extension 內使用 Selector 發生的案例
exp50000
0
110
【Data】我所碰到的 JSON
exp50000
0
47
【iOS】Google Map SDK V.S. MapKit
exp50000
0
98
【iOS】View Hierarchy
exp50000
0
95
【iOS】Auto Layout
exp50000
0
47
【iOS】Clip Subviews
exp50000
0
66
【Swift】 Tutorial Resource
exp50000
0
55
Other Decks in Technology
See All in Technology
Culture Deck
optfit
0
390
飲食店予約台帳を支えるインタラクティブ UI 設計と実装
siropaca
7
1.6k
スクラムのイテレーションを導入してチームの雰囲気がより良くなった話
eccyun
0
110
組織貢献をするフリーランスエンジニアという生き方
n_takehata
1
1.2k
SA Night #2 FinatextのSA思想/SA Night #2 Finatext session
satoshiimai
1
130
MC906491 を見据えた Microsoft Entra Connect アップグレード対応
tamaiyutaro
1
520
あれは良かった、あれは苦労したB2B2C型SaaSの新規開発におけるCloud Spanner
hirohito1108
2
370
データの品質が低いと何が困るのか
kzykmyzw
6
1.1k
トラシューアニマルになろう ~開発者だからこそできる、安定したサービス作りの秘訣~
jacopen
2
1.8k
リーダブルテストコード 〜メンテナンスしやすい テストコードを作成する方法を考える〜 #DevSumi #DevSumiB / Readable test code
nihonbuson
11
6.8k
利用終了したドメイン名の最強終活〜観測環境を育てて、分析・供養している件〜 / The Ultimate End-of-Life Preparation for Discontinued Domain Names
nttcom
1
120
『AWS Distinguished Engineerに学ぶ リトライの技術』 #ARC403/Marc Brooker on Try again: The tools and techniques behind resilient systems
quiver
0
140
Featured
See All Featured
Done Done
chrislema
182
16k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
430
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
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 程式範例