SwiftUI iOS client for over-the-air firmware updates of ESP32 devices over BLE using the Nordic Legacy DFU profile.
The app is implemented with CoreBluetooth and does not depend on proprietary mobile SDKs.
- BLE scanning with a configurable timeout and countdown.
- Device list sorted by RSSI.
- Firmware file import through the iOS file picker.
- Full Legacy DFU stage flow with visible timeline and progress.
- Configurable PRN, MTU preference, scan duration, and reconnect behavior.
- Automatic reconnect attempts on transient BLE disconnections.
- CoreBluetooth restoration support for interrupted sessions.
- Built-in localization system with multiple supported languages.
- iOS 16.0+
- Xcode 15+
- macOS with command-line tools
- XcodeGen (project is generated from project.yml)
- Physical iPhone for BLE validation
- ESP32 target running compatible DFU firmware
git clone https://github.com/Developer-RU/ESP32-DFU-iOS.git
cd ESP32-DFU-iOS
# Install XcodeGen once (if needed)
brew install xcodegen
# Generate project
xcodegen generate
# Open project
open ESP32-DFU.xcodeprojThen:
- Select a physical iPhone as the run destination.
- Configure Signing and Team in Xcode.
- Build and run.
This client uses Nordic Legacy DFU UUIDs:
- Service: 00001530-1212-EFDE-1523-785FEABCD123
- Control Point: 00001531-1212-EFDE-1523-785FEABCD123
- Packet: 00001532-1212-EFDE-1523-785FEABCD123
High-level sequence:
- Connect and discover DFU characteristics.
- Enable notifications on Control Point.
- Set PRN and send Start DFU.
- Send init packet metadata (device/app info, size, CRC32).
- Send firmware payload in chunks over Packet characteristic.
- Validate image and send Activate & Reset.
For deeper details, see docs/dfu-protocol.md.
ESP32-DFU/
App/
ESP32_DFUApp.swift
Localization.swift
Models/
BLEDevice.swift
DFUStage.swift
Services/
BLEScanner.swift
DFUSessionManager.swift
Views/
ContentView.swift
DevicePickerView.swift
SettingsView.swift
StageTimelineView.swift
Resources/
Info.plist
project.yml
# Generate project
xcodegen generate
# Build for simulator without signing
xcodebuild \
-project ESP32-DFU.xcodeproj \
-scheme ESP32-DFU \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 15' \
CODE_SIGNING_ALLOWED=NO \
build- docs/architecture.md
- docs/dfu-protocol.md
- docs/development.md
- docs/troubleshooting.md
- REAL_DFU_TEST_PLAN.md
- CONTRIBUTING.md
- SECURITY.md
- SUPPORT.md
- CHANGELOG.md
Wiki source pages are also included in the wiki directory for easy publishing to GitHub Wiki.
Use the companion firmware repository:
Typical firmware build command (PlatformIO):
pio runMIT License. See LICENSE.