xcode 9 beta 4 maybe issue with bridging header

Migrated from (working) swift 3 to 4 and no code change required. When I build, receive error: Property 'productsDictionary' not found on object of type 'SwagListVC *'.


The .m file has the following:

#import "appName-Swift.h"

...

if ([segue.identifier isEqualToString:@"ShowSwagList"] | [segue.identifier isEqualToString:@"ShowSwagListPad"])

{

SwagListVC *destViewController = segue.destinationViewController;

destViewController.title = NSLocalizedString(@"Products", @"Product List");

destViewController.productsDictionary = self.productsDict; //this is where the error is received

}


The swift file SwagListVC has the following:

var productsDictionary = [String:[String]]() //sent via segue from DetailedTableViewController


Randomly between clean/build will receive "appName-Swift.h" not found, but will go away. Next build will result in Property not found error. All ok in 8.3.3 (swift 3.1).

Answered by OOPer in 250315022

Have you tried putting `@objc` annotation?


In Swift 4, you need to put explicit `@objc` annotations to almost all members you want to expose to Objective-C side. The migrator should have shown you a dialog about `@objc` inference. (At least Xcode 9 beta 3 and beta 4 have shown it to me.)


@objc var productsDictionary = [String:[String]]()  //sent via segue from DetailedTableViewController
Accepted Answer

Have you tried putting `@objc` annotation?


In Swift 4, you need to put explicit `@objc` annotations to almost all members you want to expose to Objective-C side. The migrator should have shown you a dialog about `@objc` inference. (At least Xcode 9 beta 3 and beta 4 have shown it to me.)


@objc var productsDictionary = [String:[String]]()  //sent via segue from DetailedTableViewController
xcode 9 beta 4 maybe issue with bridging header
 
 
Q