Avatar
norio_nomura 6/15/2017 3:34 AM
これと同義ですよね。 protocol Hoge { associatedtype A func aaa() -> A } protocol HogeInt: Hoge where A == Int {} protocol HogeString: Hoge where A == String {} struct Cat {} extension Cat: HogeInt { typealias A = Int func aaa() -> Int { return 11 } } // error: 'HogeString' requires the types 'Cat.A' (aka 'Int') and 'String' be equivalent extension Cat: HogeString { func aaa() -> String { return "sss" } }