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
160
【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
230
【Swift】在 Protocol extension 內使用 Selector 發生的案例
exp50000
0
110
【Data】我所碰到的 JSON
exp50000
0
44
【iOS】Google Map SDK V.S. MapKit
exp50000
0
91
【iOS】View Hierarchy
exp50000
0
83
【iOS】Auto Layout
exp50000
0
45
【iOS】Clip Subviews
exp50000
0
63
【Swift】 Tutorial Resource
exp50000
0
38
Other Decks in Technology
See All in Technology
プロンプトエンジニアリングでがんばらない-Agentic Workflow へ-近藤憲児
kenjikondobai
2
340
Google Cloud の AI を支える裏側のインフラを垣間見る!
maroon1st
0
340
開発パフォーマンスを最大化するための開発体制
ham0215
2
360
反実仮想機械学習とは何か
usaito
PRO
11
4.5k
Compose Compiler Metricsを使った実践的なコードレビュー
tomorrowkey
1
220
Cloud Native Java with Spring Boot (CNCF Aarhus, April 2024)
thomasvitale
1
170
JSON攻略法.pdf
miyakemito
8
5k
よく聞くけど使ったことないソフトウェアNo.1 KafkaとSnowflake
foursue
4
350
20分で完全に理解するGrafanaダッシュボード
hamadakoji
3
510
リテール金融(キャッシュレス・ネット銀行・ネット証券)の競争環境と経済圏
8maki
0
920
Databricks における 『MLOps』
databricksjapan
2
170
DevOpsDays History and my DevOps story
kawaguti
PRO
9
2.5k
Featured
See All Featured
Web development in the modern age
philhawksworth
202
10k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
116
18k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
The Invisible Customer
myddelton
114
12k
Being A Developer After 40
akosma
57
580k
Building Your Own Lightsaber
phodgson
99
5.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
357
22k
Building Applications with DynamoDB
mza
88
5.6k
The Art of Programming - Codeland 2020
erikaheidi
42
12k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
Six Lessons from altMBA
skipperchong
21
3k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
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 程式範例