Created
November 29, 2024 23:23
-
-
Save colinfwren/0a1d9d4e5361a0b1d567926b09d8b67c to your computer and use it in GitHub Desktop.
Analytics enum
This file contains hidden or 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
import PostHog | |
enum Analytics { | |
case eventOne | |
case eventTwo | |
case changedTab | |
var eventName: String { | |
switch self { | |
case .eventOne: return "eventOne" | |
case .eventTwo: return "eventTwo" | |
case .changedTab: return "changed tab" | |
} | |
} | |
func capture() { | |
PostHogSDK.shared.capture(self.eventName) | |
} | |
// overload capture for values to be passed into properties dictionary | |
func capture(from: Int, to: Int) { | |
PostHogSDK.shared.capture(self.eventName, properties: [from: from, to: to]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment