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 SwiftData | |
struct ContentView: View { | |
@Environment(\.modelContext) var modelContext | |
var body: some View { | |
Button("Export your data") { | |
exportData() | |
} |
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 XCTest | |
class tab1POM { | |
let app: XCUIApplication | |
init(app: XCUIApplication) { | |
self.app = app | |
} | |
func pressTheButton() { |
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 XCTest | |
class ExamplePOM { | |
let app: XCUIApplication | |
init(app: XCUIApplication) { | |
self.app = app | |
} | |
func pressTheButton() { |
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 XCTestCase | |
final class ATest: XCTestCase { | |
override func setUpWithError() throws { | |
continueAfterFailure = false | |
} | |
@MainActor | |
func testAThing() { |
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
.onChange(of: tabSelection) { fromTab, toTab in | |
Analytics.changedTab.capture(fromTab, toTab) | |
} |
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" |
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() |
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 | |
@main | |
struct YourApp: App { | |
init () { | |
let POSTHOG_API_KEY = "" | |
let POSTHOG_HOST = "" | |
let config = PostHogConfig(apiKey: POSTHOG_API_KEY, host: POSTHOG_HOST) | |
PostHogSDK.shared.setup(config) |