A Swift Playgrounds emergency preparedness app that uses multipeer mesh networking to help people stay connected and safe during disasters.
Beacon is a Swift Playgrounds app designed for emergency situations where traditional communication infrastructure may be unavailable. Built with SwiftUI, it uses peer-to-peer mesh networking to allow nearby devices to communicate directly, share locations, and access critical disaster preparedness information.
This app demonstrates practical use of Apple's MultipeerConnectivity framework and can be easily opened and modified in Swift Playgrounds or Xcode.
- Mesh Networking: Connect directly with nearby devices using MultipeerConnectivity framework
- Real-time Location Sharing: See the locations of connected peers on a map
- Emergency Status: Send help signals to nearby users
- Resource Library: Access emergency preparedness guides for various disasters:
- Cyclone preparedness
- Water purification techniques
- First aid procedures
- And more...
- Interactive Map: View yourself and connected peers on an interactive map interface
- Swift Playgrounds 4.0+ (iPad/Mac) or Xcode 14.0+
- iPadOS 15.0+ / iOS 15.0+ / macOS 12.0+
- Swift 5.7+
- Device with Bluetooth and Wi-Fi capabilities
- Physical devices recommended for testing mesh networking (simulator has limited MultipeerConnectivity support)
Download the latest pre-built version from the Releases page:
- Go to Releases and download the latest
Beacon-App.zip - Extract the zip file
- Open the
Beacon.swiftpmfolder in Swift Playgrounds or Xcode - Run the app on your device
-
Clone the repository:
git clone https://github.com/algotyrnt/beacon.git
-
Open the
Beacon.swiftpmfolder in Swift Playgrounds app -
Tap the Run button to build and launch the app
-
Clone the repository:
git clone https://github.com/algotyrnt/beacon.git cd beacon -
Open the project in Xcode:
open Beacon.swiftpm
-
Build and run the project on your device
Note: Mesh networking requires physical devices with Bluetooth/Wi-Fi. Simulator support is limited.
- Launch the app on multiple devices
- Grant location and networking permissions when prompted
- The app will automatically discover and connect to nearby Beacon users
- Your location will be shared with connected peers
- Navigate to the Beacon tab
- Tap the emergency button to broadcast a help signal
- Connected peers will see your status change to "HELP" on their map
- Navigate to the Resources tab
- Browse through various emergency preparedness guides
- Tap on any resource for detailed information
Beacon.swiftpm/
├── BeaconApp.swift # App entry point
├── Components/ # Reusable UI components
│ ├── ResourceCard.swift
│ └── StatusCard.swift
├── Data/ # Static data and resources
│ └── ResourcesData.swift
├── Managers/ # Core functionality managers
│ ├── BeaconEngine.swift # Mesh networking engine
│ └── LocationManager.swift # Location services
├── Models/ # Data models
│ ├── BeaconPacket.swift
│ └── Resource.swift
├── ViewModels/ # View models
│ └── BeaconViewModel.swift
└── Views/ # UI views
├── BeaconView.swift
├── HomeView.swift
├── MainTabView.swift
├── ResourceDetailView.swift
└── ResourcesView.swift
Beacon uses Apple's MultipeerConnectivity framework to create a peer-to-peer mesh network. Each device:
- Advertises its presence to nearby devices
- Browses for other Beacon users
- Establishes encrypted connections
- Exchanges beacon packets containing location and status information
This allows users to maintain communication even when cellular networks and internet are unavailable.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the project
- Create your feature branch (
git checkout -b feature/<your-feature-name>) - Commit your changes (
git commit -m 'Add some Feature') - Push to the branch (
git push origin feature/<your-feature-name>) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Punjitha Bandara
- Emergency preparedness information sourced from:
- Federal Emergency Management Agency (FEMA)
- Centers for Disease Control and Prevention (CDC)
- National Weather Service (NOAA)
- Environmental Protection Agency (EPA)
This app is intended as a supplementary tool for emergency preparedness. Always follow official guidance from local authorities and emergency services during actual emergencies.