Created
November 29, 2024 23:21
-
-
Save colinfwren/80359dcb986b186c2efafc0a863a3115 to your computer and use it in GitHub Desktop.
Ading Screen names to post hog
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 SwiftUI | |
import PostHog | |
struct ContentView: View { | |
@State private var tabSelection: Int = 0 | |
var body: some View { | |
TabView(selection: $tabSelection) { | |
Tab("First View", value: 0) { | |
FirstTab() | |
.postHogScreenView("First View") | |
} | |
Tab("Second View", value: 1) { | |
SecondTab() | |
.postHogScreenView("Second View") | |
} | |
} | |
.onChange(of: tabSelection) { fromTab, toTab in | |
PostHogSDK.shared.capture("changed tab", properties: ["from": fromTab, "to": toTab]) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment