ringcentral / engage-digital-messaging-ios

Engage Digital Messaging IOS SDK
Other
10 stars 6 forks source link

Provide a way for Swift to set sharedInstance #33

Closed tylerlong closed 4 years ago

tylerlong commented 5 years ago

In Objective-C, we can do the following:

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.

waelba commented 4 years ago

Hi @tylerlong , It's fixed in v1.9.4 Thanks