How is this magic done? Could I achieve the same 1...4 behaviour with my foo
& bar
methods of my P
protocol, or is this special trick baked into the compiler?
-
I can implement just
hash(into:)
, in this case callinghashValue
calls myhash(into:)
. -
I can implement just
hashValue
, in this case callinghash(into:)
calls myhashValue
. -
if I do #2 I am getting a warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'C' to 'Hashable' by implementing 'hash(into:)' instead.
-
I can implement both
hash(into:)
andhashValue
, in this case calling each calls the corresponding methods.