https://github.com/alfianlosari/liveactivityelectionbroadcastapp
iOS Live Election Results Demo App using Live Broadcast API
https://github.com/alfianlosari/liveactivityelectionbroadcastapp
apns live-activity live-activity-broadcast liveactivity swiftui-example
Last synced: over 1 year ago
JSON representation
iOS Live Election Results Demo App using Live Broadcast API
- Host: GitHub
- URL: https://github.com/alfianlosari/liveactivityelectionbroadcastapp
- Owner: alfianlosari
- License: mit
- Created: 2024-11-08T10:40:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-08T11:36:08.000Z (over 1 year ago)
- Last Synced: 2025-01-13T23:11:22.361Z (over 1 year ago)
- Topics: apns, live-activity, live-activity-broadcast, liveactivity, swiftui-example
- Language: Swift
- Homepage:
- Size: 68.4 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Live Activity Broadcast Election Results iOS SwiftUI App

The app provides features where users can listen to realtime updates from the firestore elections collection
It also supports the new iOS Live Activity Broadcast feature using APNS Channel to display real time election activity from Lock Screen and Dynamic Island. Stacks used: iOS with SwiftUI for client, Firestore Database, Google Cloud Function with nodeJS 18 runtime.
## Requirements
- Xcode 16 & iOS 18
- Replace the bundleID for the App with your own.
- Firebase iOS Project, download `GoogleService-info.plist` to your Xcode project target.
- Provide your Apple AuthKey.p8 with Apple Push Notification support in `firebase/functions` folder.
- Navigate to index.js in `firebase/functions` folder. Provide your Apple account teamID, p8 filePath, bundleID of your app.
- Update `.firebaserc` in `firebase`` folder to use your Firebase App projectID
## Flow
1. Store the election using firestore inside elections collection.
2. Attach cloud functions to listen to create, update, and delete document to run server side code
3. on create document will trigger code to create channelId using APNS channel management API, then it will write back the channelID to the document.
4. On update document, will trigger code to broadcast live activity updates to all subscribed client devices
5. On delete document, will trigger code to delete channelID using channel management API
6. The iOS App listens to firestore collections for elections.
7. The document contains channelId which user can use to start live activity with pushType Channel
## YouTube Tutorial
You can check the full video tutorial on building this from scratch.
[YouTube](https://youtu.be/MnPvg2rO-Cw)