I would like to have an initializer, that would use parameter of type that it's current class is. It's best to show by example:
class A {
let finishBlock: @escaping (_ parameter: A) -> Void
init(finishBlock: (_ parameter: A) -> Void) {
self.finishBlock = finishBlock
}
}
class B: A {}
And now I would like to have automatic init for B, in which finishBlock would use parameter: B
So something like having:
init(finishBlock: @escaping (_ parameter: Self) -> Void) {}
Is this something that is possible to achieve? I don't want to write new init for every subclass, because I'm working on a framework, which contains a base class that will be subclassed like so often, so I would like to have this kind of behavior.