Dimelo* dimelo = [[Dimelo sharedInstance] initWithApiSecret:@"secret api key" hostname:@"api.example.com" delegate:self];
In Swift, I tried
let dimelo = Dimelo.sharedInstance()
dimelo = Dimelo(apiSecret: 'secret api key', domainName: 'api.example.com', delegate: self)
But it didn't work. Because the second statement doesn't update the sharedInstance at all.
How about we provide a method to explicitly set sharedInstance? Like this:
let dimelo = Dimelo(apiSecret: 'secret api key', domainName: 'api.example.com', delegate: self)
Dimelo.setSharedInstance(dimelo)
Otherwise I really have no idea how to make sharedInstance work in Swift. Let me know if there are some Swift syntax tricks that I am not aware of. Thanks.
In Objective-C, we can do the following:
In Swift, I tried
But it didn't work. Because the second statement doesn't update the
sharedInstance
at all.How about we provide a method to explicitly set
sharedInstance
? Like this:Otherwise I really have no idea how to make
sharedInstance
work in Swift. Let me know if there are some Swift syntax tricks that I am not aware of. Thanks.