macOS, iOS

[Swift] associatedType

SweetDev 2021. 4. 16. 10:18

프로토콜 내에서 쓰이는 Generics같은거다. 

protocol ZeddProtocol {
    associatedtype MyType
    var name: MyType { get }
}

 

[출처]

zeddios.tistory.com/382