Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7d3403a
feat(demo): add SwiftUI example app
fadi-george May 24, 2026
796c56d
chore(demo): remove SwiftUI example app
fadi-george May 24, 2026
3582a2d
feat(demo): add NSE and Widget extension targets
fadi-george May 24, 2026
db63503
refactor(demo): rename project and source dir to App
fadi-george May 24, 2026
55edd10
chore(demo): remove SwiftUI example from workspace
fadi-george May 24, 2026
b58d8a3
refactor(demo): rename main app file to App.swift
fadi-george May 24, 2026
f84be98
docs(demo): add iOS-specific build guide
fadi-george May 24, 2026
87d15d1
refactor(demo): apply design system theme to iOS UI
fadi-george May 24, 2026
6e00a4b
feat(demo): configure iOS launch screen assets
fadi-george May 24, 2026
5e4327b
refactor(demo): replace tooltip sheet with centered dialog
fadi-george May 24, 2026
b0c62c8
refactor(demo): centralize credentials in SecretsConfig
fadi-george May 24, 2026
0aaa018
chore(demo): ignore Secrets.plist file
fadi-george May 24, 2026
371f092
refactor(demo): inline push section rows as card
fadi-george May 24, 2026
3d6ff08
chore(demo): update iOS build config for Appium
fadi-george May 24, 2026
d3e81c7
fix(demo): add Secrets.plist to bundle resources
fadi-george May 24, 2026
e7504c1
chore(demo): externalize signing to Local.xcconfig
fadi-george May 24, 2026
6eb5259
refactor(demo): rename Sheet components to Dialog
fadi-george May 25, 2026
b38c3df
refactor(demo): stabilize Appium accessibility IDs
fadi-george May 25, 2026
c440ef1
refactor(demo): clarify remove button labels
fadi-george May 25, 2026
e9a31e1
refactor(demo): move dialog state to local sections
fadi-george May 26, 2026
03adc4f
refactor(demo): move toast logic to UI layer
fadi-george May 26, 2026
be91790
fix(demo): address PR review feedback
fadi-george May 26, 2026
7d7acce
fix(demo): persist consent and prefs across launches
fadi-george May 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ DerivedData
.idea/
iOS_SDK/Carthage/Build
/temp/
.build/
.build/

examples/demo/App/Secrets.plist
examples/demo/Local.xcconfig
97 changes: 27 additions & 70 deletions GettingStarted.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Getting Started with the Red App
# Getting Started

The **Red App** is a SwiftUI sample application that exercises every major feature of the OneSignal iOS SDK. Use it to validate SDK behavior, test integrations, and explore the API surface on a simulator or physical device.
This repo ships two ways to exercise the OneSignal iOS SDK:

<p align="center">
<img src="docs/assets/red-app-screenshot.png" alt="Red App screenshot" width="300"/>
</p>
| App | Location | Purpose |
|-----|----------|---------|
| **OneSignalDevApp** | `iOS_SDK/OneSignalDevApp/` | Internal dev/test app wired into `OneSignalSDK.xcworkspace`. Builds against **local SDK source**, so any changes you make to the SDK are picked up immediately. Use this when modifying the SDK. |
| **examples/demo** | `examples/demo/` | Customer-facing SwiftUI demo that mirrors the OneSignal Capacitor / Cordova / RN demos (same section layout, accessibility identifiers, sdk-shared tooltip content). Builds against the published SwiftPM SDK. Use this as a reference integration. |

## Prerequisites

Expand All @@ -15,86 +16,42 @@ The **Red App** is a SwiftUI sample application that exercises every major featu
| Swift | 5.9+ |
| iOS target | 16.0+ |

## Running the App
## Running OneSignalDevApp (SDK contributors)

### Option A — Open via the workspace (recommended)
This is the recommended path when you're working on the SDK itself.

<p align="center">
<img src="docs/assets/xcode-scheme-selector.png" alt="Xcode scheme selector showing OneSignalSwiftUIExample" style="width:90%;max-width:100%"/>
</p>

1. Open `iOS_SDK/OneSignalSDK.xcworkspace` in Xcode.
2. In the scheme selector (top-left toolbar), choose **OneSignalSwiftUIExample**.
3. Pick a simulator (e.g. iPhone 17 Pro) or a connected device.
1. Open `iOS_SDK/OneSignalSDK.xcworkspace` in Xcode (the workspace, not any individual `.xcodeproj`).
2. Select the **OneSignalDevApp** scheme.
3. Pick a simulator or a connected device.
4. Press **Cmd + R** to build and run.

Your Xcode toolbar should look like this above — scheme set to **OneSignalSwiftUIExample**, a simulator or physical device chosen, and the app running.

The workspace contains multiple schemes. Make sure **OneSignalSwiftUIExample** is selected.

Once the app is running, SDK debug logs stream to the Xcode console — useful for verifying network calls, subscription state, and in-app message events:

<p align="center">
<img src="docs/assets/xcode-console-output.png" alt="Xcode console showing SDK debug logs" style="width:90%;max-width:100%"/>
</p>

### Option B — Open from the terminal

```bash
open iOS_SDK/OneSignalSDK.xcworkspace
```

Then follow steps 2–4 from Option A.

### Option C — Open only the example project

> Use this if you only need the sample app and don't plan to modify the SDK source.

```bash
open iOS_SDK/OneSignalSwiftUIExample/OneSignalSwiftUIExample.xcodeproj
```
SDK debug logs stream to the Xcode console — useful for verifying network calls, subscription state, and in-app message events.

Select the **OneSignalSwiftUIExample** scheme, pick a destination, and run.
> Push notification delivery requires a **physical device** with a valid APNs configuration. The simulator supports permission prompts and token generation but won't receive remote pushes.

> **Note:** Opening the `.xcworkspace` (Options A/B) is preferred because it links the sample app against the SDK source, so any local SDK changes are picked up automatically.
## Running examples/demo (reference integration)

## Using Your Own App ID
The `examples/demo/` app demonstrates the recommended integration shape for app developers, including a Notification Service Extension target and a Live Activities Widget Extension target.

The default App ID (`77e32082-ea27-...c72e141824ef`) is a shared test key. To use your own:
See [`examples/demo/README.md`](examples/demo/README.md) for full setup steps. In short:

**Changing the App ID requires uninstalling and reinstalling the app for it to take effect.**
1. Create the Xcode project at `examples/demo/App.xcodeproj` (the source files and extension folders are checked in but `project.pbxproj` is not).
2. Add the OneSignal SwiftPM dependency (`https://github.com/OneSignal/OneSignal-iOS-SDK`, 5.0.0+) and attach the right products to each of the three targets (App / NSE / Widget).
3. Configure capabilities (Push Notifications, App Groups, Background Modes → Remote notifications) and run.

1. Open `iOS_SDK/OneSignalSwiftUIExample/OneSignalSwiftUIExample/Services/OneSignalService.swift`.
2. Replace the `defaultAppId` value with your OneSignal App ID (available at [onesignal.com](https://onesignal.com)).
3. Then uninstall the app from the device/simulator and run it again.
## Using your own App ID

## Features
Both apps default to a shared OneSignal App ID. To switch to your own:

The Red App is organized into scrollable sections, each mapping to a OneSignal SDK capability:
- **OneSignalDevApp** — open `iOS_SDK/OneSignalDevApp/OneSignalDevApp/AppDelegate.m` and replace the App ID passed to `OneSignal.initialize`.
- **examples/demo** — edit `examples/demo/App/Services/OneSignalService.swift` and replace `defaultAppId`, or override at runtime via `UserDefaults` (key `OneSignalAppId`).

| Section | What It Does |
|---------|-------------|
| **Logs** | Collapsible live SDK log viewer with a configurable entry limit and clear button. |
| **App Info** | Displays the current App ID and a consent-required toggle that gates SDK data processing. |
| **User** | Shows login status (Anonymous / Identified) and External ID. Login and logout buttons to switch between user states. |
| **Push** | Displays the Push Subscription ID, an enable/disable toggle, and permission status. |
| **Send Push Notification** | Quick-fire buttons (Simple, Custom) to send test push notifications to the current device. |
| **In-App Messaging** | Pause/resume in-app messages. |
| **Send In-App Message** | Trigger a test in-app message. |
| **Aliases** | Add and remove key-value aliases for the current user. |
| **Email** | Add and remove email subscriptions. |
| **SMS** | Add and remove SMS subscriptions. |
| **Tags** | Manage user tags used for audience segmentation. |
| **Outcome Events** | Fire unique, regular, or valued outcome events for analytics. |
| **Triggers** | Set and remove in-app message triggers. |
| **Track Event** | Send custom user events with optional properties. |
| **Location** | Toggle location sharing and request location permissions. |
| **Live Activities** | Start and manage iOS Live Activities via OneSignal. |
Changing the App ID requires uninstalling and reinstalling the app for it to take effect.

## Troubleshooting

| Problem | Fix |
|---------|-----|
| Build fails with missing framework | Make sure you opened the **`.xcworkspace`**, not the `.xcodeproj`. |
| Push notifications don't arrive on simulator | Push delivery requires a **physical device** with a valid APNs configuration. The simulator supports permission prompts and token generation but won't receive remote pushes. |
| "Consent Required" blocks SDK calls | Toggle **Consent Required** off, or call the consent API to grant consent. |
| Build fails with missing framework | Open the workspace (`OneSignalSDK.xcworkspace`), not an individual `.xcodeproj`. |
| Push notifications don't arrive on simulator | Push delivery requires a physical device with APNs configured. |
| "Consent Required" blocks SDK calls | Toggle **Consent Required** off, or grant consent via the SDK's consent API. |
8 changes: 0 additions & 8 deletions OneSignalSwiftUIExample/OneSignalSwiftUIExample.entitlements

This file was deleted.

145 changes: 0 additions & 145 deletions OneSignalSwiftUIExample/OneSignalSwiftUIExample/Models/AppModels.swift

This file was deleted.

Loading
Loading