Skip to content

v1.0.2

@VistaApps-za VistaApps-za tagged this 25 May 14:35
the biggest friction point a first-time Swift dev hit walking the
install path; everything else is documentation / snippet polish that
ships on cross-deck.com.

- **`Crossdeck.current`** — process-singleton accessor. Returns the
  most-recently-started client, or `nil` before `start` has succeeded
  in this process / after the current client's `stop` is called.
  Thread-safe via an `NSLock`; safe to read from any actor or queue.

  ```swift
  // Anywhere outside a SwiftUI view (services, view models,
  // AppDelegate, Combine pipelines, background workers):
  Crossdeck.current?.identify(userId: user.id, email: user.email)
  Crossdeck.current?.track("paywall_seen")
  if Crossdeck.current?.isEntitled("pro") == true { … }
  ```

  Inside SwiftUI views, keep using `@Environment(\.crossdeck)` — it
  participates in dependency tracking and is the idiomatic answer
  for view bodies. The static accessor is for the 50% of the
  codebase that isn't a View.

  Bank-grade discipline: `stop()` clears the slot iff the stopped
  instance is the one currently advertised, so concurrent
  start+stop sequences on a second client never clobber the first
  client's slot.

- No behaviour changes. Public API is strictly additive — every
  v1.0.1 caller continues to compile and behave identically.
Assets 2
Loading