Configuration hook
It's possible to set or alter the Plot Plugin configuration programmatically by specifying a configuration hook. By default, the configuration for the Plot Plugin is set by adding a plotconfig.json
to your project, as explained on the integration guides. A use cases for this functionality is to load the config using your own configuration mechanism, instead of specifying it in the plotconfig.json
file.
Plot calls the plotLoadConfig:originalConfig loadWithConfig:loadWithConfig method after your code calls [Plot initializeWithDelegate:]
. The values of originalConfig are loaded from the plotconfig.json
file, if present. Otherwise, it uses the default values.
This means when specifying a property in both the plotconfig.json
file and the configuration hook, the configuration hook will override the configurations set in the plotconfig.json
. The callback function must be called exactly once.
A configuration hook could like this:
//define the method as a member of PlotDelegate
-(void)plotLoadConfig:(PlotConfiguration *)originalConfig
loadWithConfig:(void (^)(PlotConfiguration *))loadWithConfig {
originalConfig.publicToken = @"newToken";
loadWithConfig(originalConfig);
}