How to create an NSProxy
subclass in Swift?
Trying to add any of the init
methods fails with error:
"Super init can't be called outside of the initializer", or
"Super init isn't called on all paths before returning from initializer"
Using Objective-C subclass as a Base class works, but feels more like a hack:
// Create a base class to use instead of `NSProxy`
@interface WorkingProxyBaseClass : NSProxy
- (instancetype)init;
@end
@implementation WorkingProxyBaseClass
- (instancetype)init
{
if (self) {
}
return self;
}
@end
// Use the newly created Base class to inherit from in Swift
import Foundation
class TestProxy: WorkingProxyBaseClass {
override init() {
super.init()
}
}