0
extension BasicForm
{
    public func validate() -> Bool
    {
        return true
    }
}
open class FormBase: UIView, BasicForm
{
...
}
open class FormTextEntry: FormBase
{
        public func validate() -> Bool
        {
            some computation of validity here that's never reached
        }
}

when iterating on an array of BasicForm conforming items, validate() is not called on FormTextEntry instances. protocol extension method (noop returning true) is called. Wat?????

It ain't as trasparent as in iSteve times of a tight core of NextStep engineers.

What do I do with this swiftism????

Anton Tropashko
  • 5,486
  • 5
  • 41
  • 66
  • It's a dup of https://stackoverflow.com/questions/44703205/swift-protocol-extension-method-is-called-instead-of-method-implemented-in-subcl close as such please. – Anton Tropashko Oct 15 '19 at 11:39
  • Possible duplicate of [Swift protocol extension method is called instead of method implemented in subclass](https://stackoverflow.com/questions/44703205/swift-protocol-extension-method-is-called-instead-of-method-implemented-in-subcl) – Anton Tropashko Oct 15 '19 at 11:39

0 Answers0