Dispatch: what does the protocol extension print?
Task
protocol MyProtocol { }
extension MyProtocol {
func method() { print("In Protocol") }
}
struct MyStruct: MyProtocol {
func method() { print("In Struct") }
}
let myStruct = MyStruct()
let myProtocol: MyProtocol = myStruct
myStruct.method()
myProtocol.method()
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep