iOS SDK

Embed Polst inside an iOS app with first-class SwiftUI and UIKit support, native rendering, and an offline-friendly vote replay queue. This page is informational — there's no live render here, because native iOS code can't run in a browser. Clone the sandbox app to try it on a simulator or device.

What you get

  • First-class SwiftUI support via the PolstView view, plus a UIKit PolstViewController for legacy view-controller-based screens.
  • Native rendering — no WKWebView, no JS bridge. The widget draws with the host app's SwiftUI / UIKit stack.
  • Offline cache — last-fetched polst payloads are persisted so the widget renders even when the device is offline.
  • Vote replay queue — votes cast offline are queued locally and replayed once connectivity returns.
  • Encrypted device-id and token storage via the iOS Keychain.
  • Environment selection at SDK init via PolstClient(environment: .production) (or .staging / .dev / .custom) — passed into each render surface.

Screenshots

A single Polst rendered with the SwiftUI PolstView in the sandbox app on the iOS Simulator.
Single Polst rendered via the SwiftUI PolstView.
The same Polst rendered with the UIKit PolstViewController surface in the sandbox app.
Same Polst rendered via the UIKit PolstViewController surface for legacy screens.
The offline replay queue flushing a queued vote once connectivity returns.
Offline replay queue flushing once connectivity returns.

Try it locally

  1. Clone the embedding repo: git clone git@github.com:ajcpwnz/polst-embedding.git.
  2. Open the sandbox in Xcode: open ios/PolstSDKSandbox.xcodeproj, select the PolstSDKSandbox scheme, pick an iOS Simulator, and press Cmd+R.
  3. Follow ios/README.md for sandbox-specific run notes (Swift Package resolution, command-line build).
  4. For SDK source, issues, and releases, see the upstream polst-ios repo.

Minimal SwiftUI integration

The canonical "render a polst" call. Construct a PolstClient once at app startup, then drop a PolstView anywhere in your SwiftUI scene.

Copy this snippet

import PolstSDK
import SwiftUI

// One-time at app startup — pick the env you need.
private let polstClient = PolstClient(environment: .production)

@main
struct MyApp: App {
  var body: some Scene {
    WindowGroup {
      PolstView(shortId: "abc123XYZ_", client: polstClient)
    }
  }
}

Replace "abc123XYZ_" with any real 10-char Polst short id. The snippet is shape-only; copy-paste it into a SwiftUI app to render a single polst end-to-end. For UIKit hosts, swap PolstView for PolstViewController(shortId:, client:) and embed it as a child view controller (see ios/README.md and the sandbox's UIKitPolstHost).