Skip to content

Instantly share code, notes, and snippets.

@quintonpryce
Last active July 18, 2019 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quintonpryce/c5b8f75caac569803cccc62b1f630537 to your computer and use it in GitHub Desktop.
Save quintonpryce/c5b8f75caac569803cccc62b1f630537 to your computer and use it in GitHub Desktop.
Analytics Parameters Example
public class ExampleParameter: AnalyticsParameter {
public var parameter: ParameterType
public typealias ParameterType = [AnyHashable: Any]
init(parameters: [AnyHashable: Any]) {
self.parameter = parameters
}
}
enum ExampleParameterEnum {
case selectedSegment(Int)
case exampleMultiple(Int, Bool, Float)
public var parameter: ExampleParameter {
switch self {
case let .selectedSegment(int):
return ExampleParameter(parameters: [ "Selected Segment": int ])
case let .exampleMultiple(int, bool, float):
let double = Double(float)
return ExampleParameter(parameters: [ "Selected Segment": int,
"Switch State": bool,
"Slider Position": double ])
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment