class myObject: NSObject {
// ...
init() {
setupAsyncHandler { [weak self] in
type(of: self).myMethod(weakInstance: { [weak self] in self }) // <-- how to fix?
}
}
class func myMethod(weakInstance: () -> SomeObject?) { /*...*/ }
}
I want to allow subclasses to override myMethod, thus I need to dynamically resolve a type of the self optional but I'm not sure how to get a wrapped type out of an Optional.
What do you expect subclasses to do with the type? Are they checking for some sort of conformance at runtime? Are they altering their behavior based on what type of object it is? Both of these can be solved with as? or is casting to specific types.