NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

Bluetooth Low Energy (BLE)

Forums > iOS


I am experimenting with connecting to BLE devices and hope there maybe some experts out there who can help. I have been pretty successful at connecting to various devices but something is bugging me.

I have a Polar H7 Heart Rate Monitor - about as inductry standard as you can get.

I define

let BLE_Heart_Rate_Service_CBUUID = CBUUID(string: "0x180D")

and use

self.centralManager.scanForPeripherals(withServices: [BLE_Heart_Rate_Service_CBUUID])

as predicted the central manager calls didDiscover and I can move on to connecting, discovering characteristices etc.

I also have a development board from Cypress which is programmed with Immediate Alert service (0x1802)

I define

let BLE_Find_Me_Service_CBUUID = CBUUID(string: "0x1802")

and call

self.centralManager.scanForPeripherals(withServices: [BLE_Find_Me_Service_CBUUID])

For this device it cannot find the device. didDiscover is not called

If I try

self.centralManager.scanForPeripherals(withServices: nil)

I can debug print a list of every device found and the one I'm looking for is there.

I can filter in this call back on the name and move on but was wondering of anyone knew why scanForPeripherals works or doesnt work as I described.

Sorry if that was a bit rambling.



Hello. I'm sorry I can't help you, I'm following the 100 days course with Swift so my level is apprentice. But I would ask for your help to know where to get an example of a BLE application with Swift 5.5 where I can read and write an characteristics in a peripheral Thank you very much.


One key reason for the incredible success of Bluetooth® technology is the tremendous flexibility it provides developers. Offering two radio options, Bluetooth technology provides developers with a versatile set of full-stack, fit-for-purpose solutions to meet the ever-expanding needs for wireless connectivity🥰.

Whether a product streams high-quality audio between a smartphone and speaker, transfers data between a tablet and medical device, or sends messages between thousands of nodes in a building automation solution, the Bluetooth Low Energy (LE) and Bluetooth Classic radios are designed to meet the unique needs of developers worldwide.


Hacking with Swift is sponsored by MadMachine

SPONSORED Want to try Swift on microcontrollers? MadMachine provides ways to interact with the physical world in a Swift way. Join us and have fun!

Get it now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.