A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements. Any type that satisfies the requirements of a protocol is said to conform to that protocol.
In addition to specifying requirements that conforming types must implement, you can extend a protocol to implement some of these requirements or to implement additional functionality that conforming types can take advantage of.
docs.swift.org/swift-book/LanguageGuide/Protocols.html#//apple_ref/doc/uid/TP40014097-CH25-ID276
Protocols — The Swift Programming Language (Swift 5.3)
Protocols A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of tho
docs.swift.org
'Programming > Swift' 카테고리의 다른 글
NSError & CocoaError (0) | 2020.11.06 |
---|---|
Error (0) | 2020.11.06 |
When to Use Inheritance (0) | 2020.11.06 |
Class: UIPickerView (0) | 2020.10.30 |
Class: URLSession (0) | 2020.10.29 |