This repository contains the complete working demos used in the San Diego iOS Developers talk: "Interfacing with Bluetooth Devices in Swift" presented on September 9th, 2025.
This is a hands-on demonstration of Apple's Core Bluetooth framework in Swift, showing how iOS and macOS devices communicate with each other and with Nordic nRF52 development boards using Bluetooth Low Energy (BLE).
The demos illustrate real-world BLE connectivity patterns with working code you can run, modify, and learn from.
- Complete app using
CBCentralManagerin Swift - Runs on both iOS and macOS with native interfaces
- Scans and connects to LBS (Light Button Service) peripherals
- Discovers services & characteristics automatically
- Reads button state from connected peripherals
- Controls LED on connected peripherals
- Clean, modern SwiftUI interface with debug logging
- Complete app using
CBPeripheralManagerin Swift - Runs on both iOS and macOS with native interfaces
- Advertises LBS (Light Button Service) - Nordic's standard service
- Simulates button press/release with visual feedback
- Receives LED control commands from central devices
- Real-time button state notifications to connected centrals
- iOS ↔ iOS communication (Central ↔ Peripheral)
- macOS ↔ macOS communication (Central ↔ Peripheral)
- iOS ↔ macOS communication (Central ↔ Peripheral)
- iOS/macOS ↔ Nordic nRF52 communication (with LBS service)
- Implements Nordic's LBS specification for embedded device communication
- Mac as Central – Connecting to iOS Peripheral & nRF52

- iOS as Central – Connecting to Mac Peripheral & nRF52

- Xcode 15+
- Swift 5.0+
- iOS 17.5+ / macOS 14.5+
- Bluetooth Low Energy enabled hardware
- (Optional) Nordic nRF52 Development Kit with Light Button Service
- iOS: iPhone, iPad (Central or Peripheral)
- macOS: MacBook, iMac (Central or Peripheral)
- Cross-platform: Any combination of iOS/macOS devices can communicate
- Clone and open the project in Xcode:
git clone https://github.com/BMR11/SwiftCoreBluetoothDemo.git
cd SwiftCoreBluetoothDemo
open SwiftCoreBluetoothDemo.xcodeproj-
Run both apps on different devices/simulators:
- MyCoreBluetoothDemo (Central) - Run on iPhone/iPad/Mac
- MyPeripheral (Peripheral) - Run on another iPhone/iPad/Mac
-
Test the LBS connection:
- Option A - iOS/macOS Peripheral: Start the Peripheral app first (it will begin advertising LBS service)
- Option B - nRF52 DK Peripheral: Flash the nRF52 DK with Nordic's LBS sample code
- Start the Central app and tap "Start Scan"
- Connect to the discovered peripheral
- Press/release the button on peripheral and see it reflected on central
- Toggle the LED on central and see it controlled on peripheral!
If you have a Nordic nRF52 Development Kit:
- Flash the LBS sample to your nRF52 DK using nRF Connect SDK
- Build and run the
peripheral_lbssample from Nordic's examples - The nRF52 will advertise the LBS service automatically
- Use the Central app to connect and interact with the physical hardware
- Press the physical button on the nRF52 to see it reflected in the Central app
- Toggle the LED in the Central app to control the physical LED on the nRF52
- Production-ready code you can study and modify
- Complete BLE implementation from scanning to data exchange
- Modern SwiftUI interfaces with proper error handling
- Nordic nRF52 LBS service - standard for embedded device communication
- Real-world patterns used in IoT and embedded device applications
- Apple Core Bluetooth Framework
- Nordic nRF52 Light Button Service (LBS)
- Nordic LBS Service Documentation
"Interfacing with Bluetooth Devices in Swift"
Presented at San Diego iOS Developers
September 9th, 2025
This repository contains the exact working code demonstrated during the talk, ready for you to run, explore, and build upon.
👤 Author: Rajni Gediya
Staff Software Engineer | BLE Medical Device & App Systems

