@interface MyObjectiveCmainClass
{
@protected
NSMutableArray* thisStringIsInaccessibleInSwiftSubclasses;//this I can't access in swift subclass
}
@property NSString* thisStringIsAccessibleInSwiftSubclasses;//this I can access in swift subclass
- (void) thisMethodIsAccessibleInSwiftSubclasses;//this too I can access in Swift subclass
@end
Run Code Online (Sandbox Code Playgroud)
class MySwiftSubclass : MyObjectiveCmainClass {
override func thisMethodIsAccessibleInSwiftSubclasses() {
NSLog(self.thisStringIsAccessibleInSwiftSubclasses)
}
}
Run Code Online (Sandbox Code Playgroud)
知道为什么我无法访问我的 ObjectiveC 实例变量上的 @protected 属性吗?