I have a class hierarchy like this: MySwiftSubViewController
-> ViewController
-> UIViewController
. Here is the code:
#import <UIKit/UIKit.h>
@class SwiftClassFromPackage;
@interface ViewController : UIViewController
@property (nonatomic, strong) SwiftClassFromPackage* _Nullable someSwiftObjectFromPackage;
@end
This class is using a type from an SwiftPackage for a property. Inside the Objective-C class it seems to be fine:
#import "ViewController.h"
@import MyPackage;
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_someSwiftObjectFromPackage = [[SwiftClassFromPackage alloc] init];
}
@end
But in the Swift subclass it got an compile error when I use this property like this:
import UIKit
import MyPackage
class MySwiftSubViewController: ViewController {
override func viewDidLoad() {
super.viewDidLoad()
print("\(self.someSwiftObjectFromPackage.text)")
// Value of type 'MySwiftSubViewController' has no member 'someSwiftObjectFromPackage'
}
}
When I use this SwiftClassFromPackage
class outside the package then it is working but not when it is coming from an package.
Any suggestions why this is not working?