VarioqubInstance
public final class VarioqubInstance
extension VarioqubInstance: RuntimeOptionable
extension VarioqubInstance: VarioqubConfigurable
extension VarioqubInstance: VarioqubDefaultsSetupable
extension VarioqubInstance: FlagProvider
VarioqubInstance represents varioqub with custom cliend id.
The main goal of VarioqubInstance is to provide access to Varioqub for multiple libraries without affecting the application.
See initializeInstance(clientId:config:idProvider:reporter:)
and instance(clientId:)
-
Undocumented
Declaration
Swift
public static let null: VarioqubInstance
-
An additional key-value set to send to Varioqub server.
No operation is performed before
initialize(clientId:config:idProvider:reporter:)
is called.Declaration
Swift
public var clientFeatures: ClientFeatures { get set }
-
Enables or disables sending event when a new config is activated.
You should provide the
initialize(clientId:config:idProvider:reporter:)
reporter and implementsendActivateEvent(_:)
(for example, using AppmetricaAdapter).See also
activateConfigAndWait()
andactivateConfig(_:)
.Declaration
Swift
public var sendEventOnChangeConfig: Bool { get set }
-
Varioqub identifier.
An identifier that allows setting up the experiment for a specific device only. See Varioqub SDK integration documentation for more information. It returns nil before
fetchConfig(_:)
is completed.Declaration
Swift
public var varioqubId: String? { get }
-
Fetches a new config and stores it.
This method doesn’t apply the config, see
activateConfig(_:)
andactivateConfigAndWait()
for that.Declaration
Swift
public func fetchConfig(_ callback: FetchCallback?)
Parameters
callback
Called when fetching is completed.
-
Activates a config and notifies via a callback when it completes.
This method doesn’t block the callee.
See also:
VarioqubFacade/activateConfigAndWait()(_:)
.Declaration
Swift
public func activateConfig(_ callback: ActivateCallback?)
Parameters
callback
called when activating is completed
-
Declaration
Swift
public func activateConfigAndWait()
-
Fetches a new config and activates it.
Activating a new config isn’t performed when fetching it fails. If the fetch status is
ConfigFetcherAnswer.success
,ConfigFetcherAnswer.throttled
, orConfigFetcherAnswer.cached
, it activates a new config.Declaration
Swift
public func fetchAndActivateConfig(_ callback: FetchCallback?)
Parameters
callback
Notifies when fetching and activating is finished.
-
Adds key-value pairs into the config.
The server config has higher priority over these values.
Method doesn’t block callee and notifies about finishing via callback.
See also:
setDefaultsAndWait(_:)
.Declaration
Swift
public func setDefaults(_ defaults: [VarioqubFlag : String], callback: DefaultsCallback?)
Parameters
defaults
The dictionary with flags and values.
callback
Notifies when setting is completed.
-
Loads key-value pairs from an XML.
See details about loading and format: https://yandex.ru/support2/varioqub-app/en/sdk/ios/integration#step-3-set-the-default-configuration-using-an-xml-file
See also:
loadXmlAndWait(at:)
.Declaration
Swift
public func loadXml(at path: URL, callback: XmlParserCallback?)
Parameters
path
The path to the XML file.
callback
Notifies about finishing.
-
Loads key-value pairs from XML-encoded data.
See details about loading and format: https://yandex.ru/support2/varioqub-app/en/sdk/ios/integration#step-3-set-the-default-configuration-using-an-xml-file
See also:
loadXmlAndWait(from:)
.Declaration
Swift
public func loadXml(from data: Data, callback: XmlParserCallback?)
Parameters
data
The data that represents XML.
callback
Notifies about finishing.
-
Adds key-value pairs into config.
The server config has higher priority over these values.
See also:
setDefaults(_:callback:)
.Declaration
Swift
public func setDefaultsAndWait(_ defaults: [VarioqubFlag : String])
Parameters
defaults
The dictionary with flags and values.
-
Loads key-value pairs from an XML.
See details about loading and format: https://yandex.ru/support2/varioqub-app/en/sdk/ios/integration#step-3-set-the-default-configuration-using-an-xml-file
See also:
loadXmlAndWait(at:)
.Declaration
Swift
public func loadXmlAndWait(at path: URL) throws
Parameters
path
The path to the XML file.
-
Loads key-value pairs from XML-encoded data.
See details about loading and format: https://yandex.ru/support2/varioqub-app/en/sdk/ios/integration#step-3-set-the-default-configuration-using-an-xml-file
See also:
loadXmlAndWait(at:)
.Declaration
Swift
public func loadXmlAndWait(from data: Data) throws
Parameters
from
The data that represents XML.
-
All active flags.
Declaration
Swift
public var allItems: [VarioqubFlag : VarioqubConfigValue] { get }
-
All active keys.
Declaration
Swift
public var allKeys: Set<VarioqubFlag> { get }
-
Gets the value for the flag.
Declaration
Swift
public func get<T>(for flag: VarioqubFlag, type: T.Type, defaultValue: T?) -> T where T : VarioqubInitializableByValue
Parameters
flag
The flag.
type
Returns T.
defaultValue
The value that will be returned if nothing could be found.
Return Value
The value in the active config.
-
Gets the raw value that can be convert to a specific type.
Declaration
Swift
public func getValue(for flag: VarioqubFlag) -> VarioqubConfigValue
Parameters
flag
The flag.
Return Value
The value in the active config or an empty value if nothing could be found.