- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 117字
- 2021-07-02 23:54:29
Protocols
A protocol defines signatures or types of methods, properties, and other requirements that fit to a specific task or piece of functionality. The protocol doesn't actually implement any functionality. It only describes what an implementation will look like. A class, structure, or enumeration that provides an actual implementation of requirements can adopt the protocol. Protocols use the same syntax as normal methods but are not allowed to specify default values for method parameters.
The is operator can be used to check whether an instance conforms to a protocol. We can check for protocol conformance only if our protocol is marked with @objc for classes. The as operator can be used to cast to a specific protocol.
推薦閱讀
- Microsoft SQL Server企業(yè)級(jí)平臺(tái)管理實(shí)踐
- 輕松學(xué)大數(shù)據(jù)挖掘:算法、場(chǎng)景與數(shù)據(jù)產(chǎn)品
- 計(jì)算機(jī)信息技術(shù)基礎(chǔ)實(shí)驗(yàn)與習(xí)題
- Ceph源碼分析
- 智能數(shù)據(jù)時(shí)代:企業(yè)大數(shù)據(jù)戰(zhàn)略與實(shí)戰(zhàn)
- 數(shù)據(jù)庫(kù)原理與設(shè)計(jì)(第2版)
- 大數(shù)據(jù)精準(zhǔn)挖掘
- 企業(yè)級(jí)容器云架構(gòu)開發(fā)指南
- Splunk智能運(yùn)維實(shí)戰(zhàn)
- 機(jī)器學(xué)習(xí):實(shí)用案例解析
- Oracle 11g+ASP.NET數(shù)據(jù)庫(kù)系統(tǒng)開發(fā)案例教程
- MySQL技術(shù)內(nèi)幕:InnoDB存儲(chǔ)引擎
- 云計(jì)算
- SQL Server 2008寶典(第2版)
- 云工作時(shí)代:科技進(jìn)化必將帶來的新工作方式