So I have this method in Obj-C superclass:
+ (Class<Executor>)executorClass
I need to override it in my Swift3 child class. What I tried:
override class func executorClass() -> AnyClass // not match
override class func executorClass() -> Executor.Type // not match
override class func executorClass() -> AnyObject.Type // not match
override class func executorClass() -> Any.Type // obviously not match
Before in Swift2 the following code worked:
override class func executorClass() -> AnyObject.Type
Credit to @Harnish
The Removing Class<Executor>
in Obj-C method isn't legal, but still compilable.<Executor>
solves compilation. aka:
// Obj-C
+ (Class)executorClass
// Swift
override class func executorClass() -> AnyClass // good
Edit: credit to @Sulthan
+ (Class<Executor>)executorClass
Above code is fully legal if Executor
was protocol. However in my case it was another class. So, I guessing, this was the root of the problem.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments