Avatar
どこに投稿すればいいかわからなかったのですが、Default Protocol Extension の優先順位ってどうやって決まってるんでしょうか? 下記の例の場合、やりたいことはできているのですがルールがよくわかっていないため不安でして・・・ @swift-5.0.3 protocol Foo { associatedtype Bar func hoge() } extension Foo where Bar: Decodable { func hoge() { print("Decodable.hoge") } } extension Foo where Bar == String { func hoge() { print("String.hoge") } } struct FooImpl1: Foo { typealias Bar = [String] } struct FooImpl2: Foo { typealias Bar = String } let foo1: FooImpl1 = FooImpl1() let foo2: FooImpl2 = FooImpl2() foo1.hoge() foo2.hoge()