Avatar
Avatar
tarunon
@swift-5.5.3 import Foundation @objc protocol P { func foo() -> NSObject? } class S: NSObject, P { func foo() -> NSObject { self } } (edited)
exit status: 1 with stderr:<stdin>:2:2: error: Objective-C interoperability is disabled @objc protocol P { ~^~~~~ <stdin>:6:7: error: type 'S' does not conform to protocol 'P' class S: NSObject, P { ^ <stdin>:7:10: note: candidate has non-matching type '() -> NSObject' func foo() -> NSObject { self } ^ <stdin>:3:10: note: protocol requires function 'foo()' with type '() -> NSObject?'; do you want to add a stub? func foo() -> NSObject? ^ (edited)