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
180
【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
120
【Data】我所碰到的 JSON
exp50000
0
53
【iOS】Google Map SDK V.S. MapKit
exp50000
0
100
【iOS】View Hierarchy
exp50000
0
120
【iOS】Auto Layout
exp50000
0
51
【iOS】Clip Subviews
exp50000
0
69
【Swift】 Tutorial Resource
exp50000
0
58
Other Decks in Technology
See All in Technology
こんなところでも(地味に)活躍するImage Modeさんを知ってるかい?- Image Mode for OpenShift -
tsukaman
0
140
30万人の同時アクセスに耐えたい!新サービスの盤石なリリースを支える負荷試験 / SRE Kaigi 2026
genda
4
1.3k
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.8k
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3.9k
ブロックテーマ、WordPress でウェブサイトをつくるということ / 2026.02.07 Gifu WordPress Meetup
torounit
0
180
20260208_第66回 コンピュータビジョン勉強会
keiichiito1978
0
140
CDKで始めるTypeScript開発のススメ
tsukuboshi
1
430
仕様書駆動AI開発の実践: Issue→Skill→PRテンプレで 再現性を作る
knishioka
2
660
AWS Network Firewall Proxyを触ってみた
nagisa53
1
230
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
470
Kiro IDEのドキュメントを全部読んだので地味だけどちょっと嬉しい機能を紹介する
khmoryz
0
200
超初心者からでも大丈夫!オープンソース半導体の楽しみ方〜今こそ!オレオレチップをつくろう〜
keropiyo
0
110
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
Writing Fast Ruby
sferik
630
62k
A Tale of Four Properties
chriscoyier
162
24k
How GitHub (no longer) Works
holman
316
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
250
Believing is Seeing
oripsolob
1
55
How STYLIGHT went responsive
nonsquared
100
6k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
50k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
290
Crafting Experiences
bethany
1
49
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 程式範例