2

I have Cocoapod library that offers its functionality via an extension like this:

extension ExposedLibraryClass
{
    class func setup () { ... }
}

I have some boilerplate code that goes into setup() for every app I do, but each app also needs some bespoke bits adding after that. The problem is that this being an extension, I cannot subclass it, and just wedging bespoke code at the end of the setup() function is a very nasty solution.

What would you suggest I do, please? Thank you.

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

1 Answers1

2

Nope, extensions can not override methods defined in another extension. They are for adding new functionality to existing objects.

The only way to do what you want would be to create a subclass of SomeClass and override the methods you want.

Take a look at the documentation on extension for the list of what they can do.

Craig Siemens
  • 12,942
  • 1
  • 34
  • 51