我正在尝试将int
来自objective-c 的文件传递给swift。
我所采取的步骤确实是 segue,但遗憾的是,由于以下错误,它没有通过 int:Property 'productKey' not found on object of type 'ProductViewController *'
准备转场
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"viewProduct"]) {
ProductViewController *destVC = segue.destinationViewController;
destVC.productKey = brandID;
}
}
执行转场
dispatch_async(dispatch_get_main_queue(), ^(){
[self performSegueWithIdentifier:@"viewProduct" sender:self];
});
斯威夫特文件
class ProductViewController: UIViewController {
var productKey: Int!
override func viewDidLoad() {
super.viewDidLoad()
print(productKey)
}
}
头桥
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "ARSceneViewController.h"