import UIKit
protocol Foo {
func bar() -> CGFloat
}
struct Good: Foo {
func bar() -> CGFloat { 0 }
}
// Compile error: Type 'Bad' does not conform to protocol 'Foo'
// Note: protocol requires function 'bar()' with type '() -> CGFloat'; do you want to add a stub?
struct Bad: Foo {
// vvvvvv <== not the same as CGFloat here?
func bar() -> Double { 0 } // note: candidate has non-matching type '() -> Double'
}
FooFooGood does not conform to protocol FooFoo, in your example. So, the two func bars are distinct. Even if you add the conformance, FooFooGood::bar does not satisfy the protocol requirement, it simply defines an overload of bar that takes a Double as an argument for struct FooFooGood only.