From fa252fd5b97cc633a084216e59d70c9f90491f47 Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Tue, 7 Oct 2025 13:50:09 -0700 Subject: [PATCH] [Swiftify] Support std::span in Android NDK The Android NDK uses `std.__ndk.span` rather than `std.__1.span`. --- lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift b/lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift index 3f2a99749f998..32123e1de0aaf 100644 --- a/lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift +++ b/lib/Macros/Sources/SwiftMacros/SwiftifyImportMacro.swift @@ -262,12 +262,11 @@ func isRawPointerType(text: String) -> Bool { // Remove std. or std.__1. prefix func getUnqualifiedStdName(_ type: String) -> String? { - if type.hasPrefix("std.") { - var ty = type.dropFirst(4) - if ty.hasPrefix("__1.") { - ty = ty.dropFirst(4) + let prefixes = ["std.__1.", "std.__ndk1.", "std."] + for prefix in prefixes { + if type.hasPrefix(prefix) { + return String(type.dropFirst(prefix.count)) } - return String(ty) } return nil }