1

The app in question here starts with a class being injected directly from the AppDelegate with its UIWindow:

public var window: UIWindow? {
    get { return nil }
    set {
        guard _window == nil else { return }
        _window = newValue
        _window.makeKeyAndVisible()
        start()
    }
}

The above code resides in a Cocoapod, and the idea with the start() function is that it gets a bespoke implementation in whatever code/app is implementing said Cocoapod:

extension TheStartingClass {
    func start () {
        // do whatever needs doing...
    }
}

"TheStartingClass" is a class that has a TheStartingClassProtocol, both of which are in the Cocoapod. Whether:

  1. the start function is in the protocol and the class; or

  2. the start function is in the protocol and the protocol extension; or

  3. the start function is only in the protocol extension,

when re-implemented in extension TheStartingClass outside the Cocoapod, the re-implementation is ignored, I'm guessing because of something to do with the way protocols dispatch methods.

How can I change this code so that func start () in extension TheStartingClass is actually called?

Thank you for reading.

Joseph Beuys' Mum
  • 2,395
  • 2
  • 24
  • 50

0 Answers0