[iOS] associatedType

associatedType

사용법

protocol Example {
    associatedtype Item
    func append(_ item: Item)
}
struct TypeExample {
    typealias Item = Int
    
    var items = [Item]()
    
    func append(_ item: Int) {
        self.items.append(item)
    }
}