import Foundation class Piyo<H>: NSObject { } class Hoge: NSObject { } extension Hoge { func hello() -> Piyo<String> { fatalError() } } class Fuga: Hoge { override func hello() -> Piyo<String> { // Declerations from extensions cannot be overriden yet return Piyo() } }
import Foundation class Hoge: NSObject { } extension Hoge { func hello() -> AnyObject { fatalError() } } class Fuga: Hoge { override func hello() -> AnyObject { return "hello" as AnyObject } } Fuga().hello()
↑のでこれは通る