Swift Protocols with Associated Type Requirement and Default Implementation
问题 I have been struggling very hard with Swift Protocols and Associated Types for a long time. I started again with basic to really understand what is going wrong and I followed this article of TypeErasure in Swift Protocols with Associated Type Requirement by Rob Napier but still i have no luck. Find the code below // An Animal can eat protocol Animal { associatedtype Food func feed(food: Food) -> Void } struct AnyAnimal<Food>: Animal { private let _feed: (Food) -> Void init<Base: Animal where