segment-integrations / analytics-swift-optimizely

Swift
MIT License
0 stars 1 forks source link

Can the `OptimizelyClient` get passed back after initialization, or setup? #7

Closed skydivedan closed 8 months ago

skydivedan commented 8 months ago

I'm currently using Optimizely in my iOS project, to control whether certain features are surfaced (or hidden) in my app. So I make calls to the OptimizelyClient like isFeatureEnabled or getFeatureVariableString.

Since analytics-swift-optimizely actually instantiates an OptimizelyClient, it would be nice if that client was either passed back, or otherwise made available to the caller. Right now it's private, and I don't understand why.

For an example of what I'm talking about, the BrazeDestination for Segment has a callback in it's init routine, which will get called after the Braze instance is instantiated from the data from Segment. It passes the instance of Braze in the caller, allowing the caller to perform extra configuration.

In the Optimizely case, it could pass back an OptimizelyClient, and then I could use that client to do regular Optimizely things, like get the state of various feature flags. But right now, I'd need to create a new instance of OptimizelyClient -- which I'd rather not do.

Just wondering if this is anything that is being considered in an update.

alanjcharles commented 8 months ago

Hi @skydivedan thanks for bringing this to our attention. A fix is available in 1.1.1 please let us know if you run into any other issues. Thanks!