Created
August 25, 2017 13:04
-
-
Save frootloops/9d47a61623c749b9faf2705b9693e0fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UserEvents: TrackingEventType { | |
var identifier: String { | |
switch self { | |
case .created: | |
return "user.created" | |
case .openApp: | |
return "user.open-app" | |
case .bought: | |
return "user.bought" | |
case .sentMessage: | |
return "user.sent-message" | |
} | |
} | |
var properties: [String: Any] { | |
switch self { | |
case let .created(user): | |
return ["name": user.name, "age": user.age] | |
case let .bought(product): | |
return ["title": product.title, "price": product.price] | |
default: | |
return [:] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment