You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-942 Cannot provide default implementation of @objc protocol via extension
SR-1230 Using a Selector("function") does not work when the "function" is defined via a Protocol Extension
SR-9676 Default implementation for optional protocol functions not invoked
Issue Description:
When class conform the protocol that supplies some method and if the method have default implementation in protocol extension then _respondsToSelector _method return false.
protocolSomeProtocol{
funcfoo()->Void
}
extensionSomeProtocol{
funcfoo()->Void{
// do something
}
}
classSomeClass : NSObject, SomeProtocol{
}
let some =SomeClass()
some.respondsToSelector("foo")
The text was updated successfully, but these errors were encountered:
respondsToSelector is just a thin veil on class_respondsToSelector so this would be more the objc runtime's domain than Foundation. However is it the case that the protocol would have to have some decorator to be exposed as objc for this to work?
Right, methods in protocol extensions are not exposed to Objective-C, ever. It's a little unfortunate that we don't have a way to manually do that from the class, though; if you redeclare the method you can't use the default implementation.
I faced the similar problem: I have an existing Objective-C protocol with a method which I would like to refine for Swift to use Tuples instead of unsafe pointers. However it does seem to be possible.
Additional Detail from JIRA
md5: 5ed2a55af47268aca30c35583bd87d96
is duplicated by:
Issue Description:
When class conform the protocol that supplies some method and if the method have default implementation in protocol extension then _respondsToSelector _method return false.
The text was updated successfully, but these errors were encountered: