프로토콜은 특정 작업이나 기능에 적합산 메서드, property 및 기타 요구 사항의 청사진
클래스, 구조체, 열거형에서 채택할 수 있음
추가 기능을 구현하도록 Protocol Extension도 가능
protocol SomeProtocol {
// protocol definition goes here
}
struct SomeStructure: FirstProtocol, AnotherProtocol {
// structure definition goes here
}
class SomeClass: SomeSuperclass, FirstProtocol, AnotherProtocol {
// class definition goes here
}
protocol SomeProtocol {
var mustBeSettable: Int { get set }
var doesNotNeedToBeSettable: Int { get }
}