Swiftpack.co - Package - PureSwift/BluetoothLinux


Swift Platform Release Build Status License CodeBeat

SPM compatible

Pure Swift Bluetooth Stack for Linux

Does not require BlueZ, communicates directly with the Linux kernel and Bluetooth controller.


import Bluetooth
import BluetoothLinux

guard let hostController = HostController.default
    else { Error("No Bluetooth adapters found") }
let iBeaconUUID = Foundation.UUID(rawValue: "E2C56DB5-DFFB-48D2-B060-D0F5A71096E0")!
do { try hostController.enableBeacon(uuid: iBeaconUUID, major: 1, minor: 1, rssi: -29) }
catch { print("Error enabling iBeacon: \(error)") }


Swift Package Manager

import PackageDescription

let package = Package(
    dependencies: [
        .Package(url: "https://github.com/PureSwift/BluetoothLinux.git", majorVersion: 3)


Documentation can be generated with Jazzy.

swift package generate-xcodeproj

Read the documentation here. For more information, see the gh-pages branch.


Do not test in Parallels or VMware with the built in Bluetooth adapter found in Macs. You can, however, use VMWare or Parallels, with a Linux compatible Bluetooth LE USB adapter plugged in. VirtualBox will work with the builtin adapter on Macs.

For best results, test with Swift 4.1.2 on an ARM board running Linux (e.g. BeagleBoneBlack, Raspberry Pi, Orange Pi, etc) and a Linux comaptible Bluetooth dongle (e.g. CSR8510 A10).

See Also

  • Bluetooth - Pure Swift Bluetooth Definitions.
  • GATT - Bluetooth Generic Attribute Profile (GATT) for Swift
  • SwiftFoundation - Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library.
  • Cacao - Pure Swift Cross-platform UIKit
  • Silica - Pure Swift CoreGraphics (Quartz2D) implementation
  • Predicate - Pure Swift Predicate implementation


BluetoothLinux is released under the MIT license. See LICENSE for details.


Stars: 118
Help us keep the lights on



4.1.0 - Apr 29, 2019

  • b6d4904 Support Swift 5
  • 2e3c8ff Added NSPOSIXError

4.0.0 - Nov 18, 2018

  • d123f40 Updated for Swift 4.1, deprecated Swift 3 support

3.2.0 - Sep 12, 2018

  • 881c319 MakeL2CAPSocket non-blocking

3.1.2 - Aug 4, 2018

  • #33 Fixed HCI Remote Name Request usage.

3.1.1 - Jul 20, 2018

  • Updated AddressType