- 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.
推薦閱讀
- 數據庫應用實戰
- Unity 5.x Game AI Programming Cookbook
- InfluxDB原理與實戰
- Python金融大數據分析(第2版)
- Voice Application Development for Android
- 文本數據挖掘:基于R語言
- Libgdx Cross/platform Game Development Cookbook
- 揭秘云計算與大數據
- Lean Mobile App Development
- 深入淺出MySQL:數據庫開發、優化與管理維護(第2版)
- Oracle高性能自動化運維
- 智能數據時代:企業大數據戰略與實戰
- 信息學競賽寶典:數據結構基礎
- Flutter Projects
- 達夢數據庫運維實戰