Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
110
【Data】我所碰到的 JSON
exp50000
0
53
【iOS】Google Map SDK V.S. MapKit
exp50000
0
100
【iOS】View Hierarchy
exp50000
0
110
【iOS】Auto Layout
exp50000
0
49
【iOS】Clip Subviews
exp50000
0
67
【Swift】 Tutorial Resource
exp50000
0
57
Other Decks in Technology
See All in Technology
"なるべくスケジューリングしない" を実現する "PreferNoSchedule" taint
superbrothers
0
130
How native lazy objects will change Doctrine and Symfony forever
beberlei
1
300
進化の早すぎる生成 AI と向き合う
satohjohn
0
460
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3.2k
私のRails開発環境
yahonda
0
170
[続・営業向け 誰でも話せるOCI セールストーク] AWSよりOCIの優位性が分からない編(2025年11月21日開催)
oracle4engineer
PRO
1
190
ECMAScript仕様の最新動向: プロセスの変化と仕様のトレンド
uhyo
1
280
ブラウザ拡張のセキュリティの話 / Browser Extension Security
flatt_security
0
230
Active Directory 勉強会 第 6 回目 Active Directory セキュリティについて学ぶ回
eurekaberry
15
5.3k
Dify on AWS の選択肢
ysekiy
0
120
.NET 10 のパフォーマンス改善
nenonaninu
2
3.5k
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
970
Featured
See All Featured
Optimizing for Happiness
mojombo
379
70k
GitHub's CSS Performance
jonrohan
1032
470k
Embracing the Ebb and Flow
colly
88
4.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
690
How to train your dragon (web standard)
notwaldorf
97
6.4k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
How STYLIGHT went responsive
nonsquared
100
5.9k
Building Adaptive Systems
keathley
44
2.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
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 程式範例