From 42d4397a90134dec9d684a66c8ef8caf1ed62ef9 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Tue, 21 Jul 2026 16:08:27 -0400 Subject: [PATCH] Import the embedded Foundation shim in AdvertisementData The 128-bit service class UUID lists decode into `UUID`, but this file only imported Bluetooth and BluetoothGAP, so under Embedded Swift the type had no declaring module in scope: struct 'UUID' cannot be used in an embedded function not marked '@export(interface)' because 'FoundationEmbedded' was not imported It goes unnoticed building the target on its own, since BluetoothGAP isn't present and the `canImport(BluetoothGAP)` block compiles out. It only shows up once something else in the graph pulls BluetoothGAP in - a GATT server, for instance - which is how the embedded CI matrix misses it. Uses the same conditional import BluetoothGAP itself uses for the type it hands back. --- Sources/GATT/AdvertisementData.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/GATT/AdvertisementData.swift b/Sources/GATT/AdvertisementData.swift index 961d649..10eb1bd 100644 --- a/Sources/GATT/AdvertisementData.swift +++ b/Sources/GATT/AdvertisementData.swift @@ -6,6 +6,15 @@ // Copyright © 2018 PureSwift. All rights reserved. // +#if canImport(Foundation) +#if canImport(FoundationEssentials) +import FoundationEssentials +#else +import Foundation +#endif +#elseif canImport(FoundationEmbedded) +import FoundationEmbedded +#endif @_exported import Bluetooth #if canImport(BluetoothGAP) import BluetoothGAP