Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

794 B
Raw Blame
import CodyncKit
import SwiftUI

extension View {
    /// Records `event` each time this view appears, and again whenever it changes while shown
    /// (a tab or a step); nil records nothing.
    public func tracked(_ event: AnalyticsEvent?) -> some View {
        onAppear { if let event { Analytics.shared.capture(event) } }
            .onChange(of: event) { _, event in if let event { Analytics.shared.capture(event) } }
    }

    /// Records `link_opened` for a link opened inside this view (`Link`, a link in `Text`); the
    /// system still opens it.
    public func trackedLinks(_ link: AnalyticsEvent.Link) -> some View {
        environment(\.openURL, OpenURLAction { _ in
            Analytics.shared.capture(.linkOpened(link))
            return .systemAction
        })
    }
}