---
title: "What the demo app learned. (iOS)"
url: "https://platformdocs.coinme.com/#/build/native/ios/patterns"
markdown: "https://platformdocs.coinme.com/pages/build/native/ios/patterns.md"
summary: "Six integration patterns lifted from the Coinme demo app, each with the SDK call it depends on, and the one lifecycle that outlives the session: cash barcodes."
surface: "ramp"
platform: "ios"
package: "CoinmeBridge for iOS"
version: "1.3.0"
---

# What the demo app learned.

Six integration patterns lifted from the Coinme demo app, each with the SDK call it depends on, and the one lifecycle that outlives the session: cash barcodes.

## Six patterns the demo app is built on

None of them is required. All of them came from shipping a real integration, and each one removes a class of bug.

### 1. Build once, hide and show

Loading the Orchestrator and completing the handshake takes seconds. Create the SDK view at launch, keep it for the life of the screen, and merely hide it when the panel closes.

Depends on: `container.embed(vc, in:) · isHidden`

### 2. Restart, don't rebuild

Each purchase sends a fresh config and tells the running flow to re-initialise. The web app, sign-in and bridge session are reused. Queued automatically if called before ready.

Depends on: `restartTransaction(with: config, payload:)`

### 3. Config from app state

One side-effect-free builder turns your order model into a CoinmeConfig. One place to audit what is sent to Coinme, and a natural home for defaults.

Depends on: `CoinmeConfigBuilder.makeConfig(…)`

### 4. Translate events once

The SDK hands you 18 events; three mean "the session is over" and two are barcode shapes. Fold them into a small set of app events so your UI never imports the SDK.

Depends on: `protocol OrchestratorSessionEvents`

### 5. Ignore stale sessions

Every callback first checks the sender is the live session. Clearing the delegate on teardown makes this redundant, but it costs nothing and guards a callback mid-teardown.

Depends on: `guard vc === coinmeViewController`

### 6. Two IDs, two lifetimes

externalSessionId is fixed for the app session; externalTransactionId is fresh per attempt. Both are attached to Coinme's logs so you can line them up with yours.

Depends on: `externalSessionId · externalTransactionId`

## A purchase that outlives the session.

A cash order produces a barcode the user takes to a store. That can be hours later. Store the `orderTemplateId` when barcodeGenerated arrives, offer to resume it on the next launch, and clear it when barcodeInvalidated arrives. Cancelling rides along in the next restartTransaction payload, so there is no separate cancel call.

Events involved: `bridge.barcode.generated`, `bridge.barcode.deleted`, `host.barcode.resume`.

This section summarises the Coinme demo app for iOS and the CoinmeBridge 1.3.0 SDK. The demo places the widget inside its own native surface; a plain present() is simpler and equally supported.

- [The Bridge explainer](https://platformdocs.coinme.com/pages/explainers/bridges.md)
- [CoinmeConfig field reference](https://platformdocs.coinme.com/pages/build/index.md#config)
- [Quick start on docs.coinme.com](https://docs.coinme.com/docs/ios-quick-start)
