open class BaseTransformer<T> : ConfigurationTransforming

BaseTransformer it’s a helper class which can be used with ConfigurationTransformer to tranform a value to a typed object using any transformer method. The method can be a static func, a closure or an initializer.

*There are several default transformers in the SDK which can be used as transformer

  • transformToURL
  • transformToValue: generic method for any base value type; can be used
  • OAuth2AuthenticationParameters.init(discoveryServiceConfig:)
  • SAMLAuthenticationParameters.init(discoveryServiceConfig:) Example structure: “`Swift let configuration : [String: Any] = [ "someExampleURL”: “”, “someString” : “An arbitrary string”, “settingsExchange” : [ “passwordPolicy”: [ “somePolicyProperty”:“someValue”, “somePolicyProperty2”:“someValue2”, ], “logSettings”: [ “someLogProperty”:“someValue”, “someLogProperty2”:“someValue2”, ] ] ]

// The example transformationMap for the structure let sampleTransformationMap : [String: ConfigurationTransforming] = [ “someExampleURL” : BaseTransformer(targetKey: .requiredURL, transformer: transformToURL), “someString” : BaseTransformer(targetKey: .requiredString), “settingsExchange” : ConfigurationTransformer(transformationMap: [ “passwordPolicy” : BaseTransformer(targetKey: .passcodePolicy, transformer: FUIPasscodePolicy.init(sapcpmsSettingsPasswordPolicy:)), “logSettings” : BaseTransformer(targetKey: .sapcpmsLogSettings, transformer: SAPcpmsLogSettings.init(sapcpmsLogSettings:)) ]) ]

  • initializes a transformer which calls the transformer passed in the parameter to tranform the data to another data and returns it associating it with the targetKey parameter



    public init(targetKey: OnboardingInfoKey, transformer: @escaping (_ config: Any) throws -> T = transformToValue)



    transformed data will be associated with this key in the returning dictionary


    closure, func or initializer which can transform the input data of the transform(config:) method to another data

  • Transform the input data using the associated transformer to another data and associates the result with the key associated with this instance


    errors thrown by tranformers



    open func transform(config: Any) throws -> [OnboardingInfoKey : Any]



    the input config data

    Return Value

    [OnboardingInfoKey: Any] dictionary of the transformed data where the key is the associated key and the data is the result of the transformer