Hello everyone,
I've got my project written in Objective-C. I am learning about bridging.
I bridged successfully Swift into my Objective-C project. I did some VC pushing between Objective-C VC and Swift VC. Everything works as it supposed to.
However, I created the reference to my Objective-C NetworkManager (I used Singleton pattern) in my Swift file like that:
For some reason I cannot use methods from it.
Just to show you how I've created my NetworkManager as a Singleton. I found that solution online and it was quite old, if you have any better solution, I would be more than happy to get some insight:
Not sure what is the issue here. Thank you all for the help.
I've got my project written in Objective-C. I am learning about bridging.
I bridged successfully Swift into my Objective-C project. I did some VC pushing between Objective-C VC and Swift VC. Everything works as it supposed to.
However, I created the reference to my Objective-C NetworkManager (I used Singleton pattern) in my Swift file like that:
Code Block let networkManager = NetworkManager.sharedManager()
For some reason I cannot use methods from it.
Code Block networkManager.getUserInfo() // .getUserInfo() will not appear!
Just to show you how I've created my NetworkManager as a Singleton. I found that solution online and it was quite old, if you have any better solution, I would be more than happy to get some insight:
Code Block + (id)sharedManager { static NetworkManager *sharedMyManager = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedMyManager = [[self alloc] init]; }); return sharedMyManager; } -(id)init { if (self = [super init]) { someProperty = @"Default Property Value"; self.cache = [[NSCache alloc] init]; } return self; }
Not sure what is the issue here. Thank you all for the help.