I get the following compiler error for Objective-C code.
The receiver type “DataBase” for the message, for example, is a forward declaration for Objective-C code.
Quick code
@objc class SharedData : NSObject { var dataBase : Database? class var sharedData : SharedData { struct Static { static var onceToken: dispatch_once_t = 0 static var instance: SharedData? = nil } dispatch_once(&Static.onceToken) { Static.instance = SharedData() } return Static.instance! } }
Target Code C
SharedData *sharedData = [SharedData sharedData]; [sharedData.dataBase grabData];
My guess: I messed up a fast singleton, and I need a specific singleton that works with Objective-C code, but I'm not too sure. Also, this is just a sample code, my real code is different and more complex. However, this should demonstrate my problem.
source share