I'm using a third-party library for a new app that I'm making using Swift. The author of the class/library has made it final using the final
keyword, probably to optimise and to prevent overriding its properties and methods.
Example:
final public class ExampleClass {
// Properties and Methods here
}
Is it possible for me extend the class and add some new properties and methods to it without overriding the defaults?
Like so:
extension ExampleClass {
// New Properties and Methods inside
}
While you cannot create new stored properties in extensions you can add methods and computed properties.
Example computed property: