-
[Swift] 프로토콜 메서드 요구사항 (Method Requirements)iOS/🟠 Swift 2021. 1. 18. 23:03
참고 자료: Protocols - swift.org 속성과 마찬가지로 method 도 `static` 키워드를 통해 type method를 구현할 수 있습니다. 일반적인 instance method 와 type method처럼 정의하면 되지만, 프로토콜은 구현은 하지 않는 요구사항 이기 때문에 { } (curly brace) 에 해당하는 바디 부분은 없습니다. Syntax protocol SomeProtocol { // Type method // with no-input, no-return static func someTypeMethod() } protocol RandomNumberGenerator { // Instance Method // with no-input, Double type return f..