Skip to content

Instantly share code, notes, and snippets.

@mukyasa
Last active April 23, 2020 07:04
Show Gist options
  • Select an option

  • Save mukyasa/a631aab280ae780d7b7ed52be4499c3a to your computer and use it in GitHub Desktop.

Select an option

Save mukyasa/a631aab280ae780d7b7ed52be4499c3a to your computer and use it in GitHub Desktop.
protocol EventProtocol {
var name: String { get set }
var params: [String: Any] { get set }
}
@propertyWrapper
struct Event: EventProtocol {
var name: String
var params: [String: Any] = [:]
var wrappedValue: Event {
return Event(name: name,
params: params)
}
}
// Helper init methods
extension Event {
init(screenValue: String) {
self.init(name: EventName.screenVisit,
params: [ParameterName.screen: screenValue])
}
init(clickValue: String) {
self.init(name: EventName.clickEvent,
params: [ParameterName.click: clickValue])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment