Using associatedtype in a delegate protocol for a generic type
问题 I have a Game class. I made it generic because I was need to support different types of boards. Now I just want to add a classical iOS-style delegate with a method which will take a game and a new points value as parameters. How to achieve this in the Swift associatedtype way? I really confused that I can't impelemnt such simple logic. protocol GamePointsDelegate { associatedtype B: Board func game(_ game: Game<B>, didSetPoints points: Int) } class Game<B: Board> { let board: Board var points