Skip to main content

Channels

A channel is a named release track. Each device subscribes to exactly one channel; releases published to a channel are only visible to devices on that channel. Think of channels as concurrent, independent release lines.

Default channels

swiftpatch init creates three channels for you:

ChannelPurposeTypical source
devDeveloper builds, noisy, no rollout gatesLocal laptops
stagingQA + internal testersCI on merge to develop
productionReal usersCI on tagged release

You can rename, delete, or add more at any time. Most teams add beta for external testers and short-lived channels for major feature rollouts.

Setting the channel at runtime

import { setChannel, getChannel, onChannelChanged } from '@swiftpatch/react-native';

// Persist to native storage — survives cold starts
await setChannel('beta');

// Read the current channel
const channel = await getChannel();

// Subscribe to changes
const unsub = onChannelChanged((channel) => {
console.log('Channel is now:', channel);
});

The channel is included in every checkForUpdate request. The server responds with releases targeted at that channel only.

Setting the channel at build time

If you bundle channel-specific binaries (for example, an alpha APK that always runs the alpha channel), gate setChannel behind a flag:

import { setChannel } from '@swiftpatch/react-native';

if (Config.BUILD_CHANNEL) {
await setChannel(Config.BUILD_CHANNEL);
}

Promotion between channels

The most common flow is staging → production. Do it from the CLI:

# Ship to staging
swiftpatch deploy --channel staging -p ios --hermes

# After QA signs off, promote the exact release bytes to production
swiftpatch releases promote r_abc123 --from staging --to production --rollout 10

Promotion does not rebundle. The bytes that were tested on staging are the bytes that reach production. This eliminates "works on staging, breaks on prod" entirely.

Per-device channel switching (beta program)

Build a beta opt-in UI in your app's settings:

import { setChannel } from '@swiftpatch/react-native';
import { Button } from 'react-native';

function JoinBeta() {
return (
<Button
title="Join the beta program"
onPress={async () => {
await setChannel('beta');
Alert.alert('You are now on the beta channel. Beta updates will arrive automatically.');
}}
/>
);
}

The next checkForUpdate call (triggered on resume or by your UI) will look for beta releases. No restart required.

Channel policies

Each channel can have policies attached from the dashboard. Example:

PolicyMeaning
require-approversNumber of dashboard approvers required before a release goes active.
default-rolloutIf --rollout is not specified on deploy, use this percent.
auto-pause-crash-ratePercent crash-rate delta above baseline that triggers an automatic rollout pause.
allow-mandatoryWhether releases on this channel may set --mandatory.
max-sizeReject bundles larger than N MB.

Channel isolation

  • Deployment keys are channel-scoped. A key for staging cannot read production.
  • CI tokens can be scoped to specific channels: swiftpatch ci-tokens create --channels staging,beta.
  • Releases do not leak across channels.

Common patterns

Feature-flag channel for a launch

Ship a new, experimental version behind a channel named after the feature:

swiftpatch channels create checkout-v2 -a my-app
swiftpatch deploy --channel checkout-v2 -p ios --hermes

In-app, users who have opted in run:

await setChannel('checkout-v2');

When ready for everyone:

swiftpatch releases promote r_xyz --from checkout-v2 --to production --rollout 5

Emergency rollback via channel

If production has a bad release and you need to freeze updates for a subset of users:

# Create a temporary "hold" channel
swiftpatch channels create production-hold -a my-app

# Have your app switch the stuck users over via a feature flag
# await setChannel('production-hold');

# Ship the fix to production-hold
swiftpatch deploy --channel production-hold -p ios --hermes

# Once the fix is verified, promote to production
swiftpatch releases promote r_fix --from production-hold --to production

Next steps

  • Rollouts — percent-based gradual rollouts.
  • White-label — switch the entire deployment key at runtime for multi-tenant apps.
  • CLI channelsswiftpatch channels create, list, delete.