Declarations in extensions cannot override yet error in Swift 4
ios, swift, swift-playground, swift4
Solution
It will work if you make the base implementation `@objc`. See Hamish's answer for a detailed explanation about the internals.
Overriding methods declared in extensions is a bit tricky to do correctly. Objective-C supports it, but it's not absolutely safe. Swift aims to do it better. The proposal is not completed yet.
Current version of the proposal available here.
Problem
I have an extension: ``` public extension UIWindow { override public func topMostController()->UIViewController? { ... } } ``` but for my `topMostController` I get the next error: ``` Declarations in extensions cannot override yet error ``` It works well for Swift 3.1, but for Swift 4 I get this error. How can it be fixed? What did they change in Swift 4?