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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
68
【Swift】 Tutorial Resource
exp50000
0
58
Other Decks in Technology
See All in Technology
生成AI時代にこそ求められるSRE / SRE for Gen AI era
ymotongpoo
5
3.2k
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
140
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
1
410
Kiro IDEのドキュメントを全部読んだので地味だけどちょっと嬉しい機能を紹介する
khmoryz
0
200
量子クラウドサービスの裏側 〜Deep Dive into OQTOPUS〜
oqtopus
0
120
Red Hat OpenStack Services on OpenShift
tamemiya
0
110
こんなところでも(地味に)活躍するImage Modeさんを知ってるかい?- Image Mode for OpenShift -
tsukaman
0
140
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
Embedded SREの終わりを設計する 「なんとなく」から計画的な自立支援へ
sansantech
PRO
3
2.4k
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
2
380
Bedrock PolicyでAmazon Bedrock Guardrails利用を強制してみた
yuu551
0
230
OpenShiftでllm-dを動かそう!
jpishikawa
0
110
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
710
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
120
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
Amusing Abliteration
ianozsvald
0
100
The Curious Case for Waylosing
cassininazir
0
240
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Embracing the Ebb and Flow
colly
88
5k
Crafting Experiences
bethany
1
49
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
190
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 程式範例