Skip to content

Commit d9b009a

Browse files
pblazejclaude
andcommitted
fix: prevent LKObjCHelpers from leaking into swiftinterface
Use @_implementationOnly import under LK_XCFRAMEWORK flag so the ObjC helpers module is available at compile time but excluded from the public .swiftinterface, which consumers cannot resolve. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0875533 commit d9b009a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Sources/LiveKit/Broadcast/LKSampleHandler.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ import ReplayKit
2323
import Combine
2424
import OSLog
2525

26-
#if !COCOAPODS
26+
#if LK_XCFRAMEWORK
27+
@_implementationOnly import LKObjCHelpers
28+
#elseif !COCOAPODS
2729
import LKObjCHelpers
2830
#endif
2931

scripts/xcframework.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ func generateFrameworkProject(at projectPath: Path, repoRoot: Path) throws {
261261
"MACH_O_TYPE": "mh_dylib",
262262
"CLANG_ENABLE_MODULES": "YES",
263263
"HEADER_SEARCH_PATHS": "$(inherited) " + (repoRoot + "Sources/LKObjCHelpers/include").string,
264-
// LKObjCHelpers needs its own modulemap so `import LKObjCHelpers` works in Swift
264+
// LK_XCFRAMEWORK flag replaces `import LKObjCHelpers` with `@_implementationOnly`
265+
// to prevent leaking into .swiftinterface
266+
"SWIFT_ACTIVE_COMPILATION_CONDITIONS": "LK_XCFRAMEWORK",
265267
"SWIFT_INCLUDE_PATHS": "$(inherited) " + (repoRoot + "Sources/LKObjCHelpers").string,
266268
])
267269
pbxProj.add(object: targetConfig)
@@ -316,7 +318,7 @@ func generateFrameworkProject(at projectPath: Path, repoRoot: Path) throws {
316318
}
317319
}
318320

319-
// --- Create LKObjCHelpers modulemap if it doesn't exist ---
321+
// --- Create LKObjCHelpers modulemap if needed ---
320322
let modulemapPath = repoRoot + "Sources" + "LKObjCHelpers" + "module.modulemap"
321323
if !modulemapPath.exists {
322324
try modulemapPath.write("module LKObjCHelpers {\n header \"include/LKObjCHelpers.h\"\n export *\n}\n")

0 commit comments

Comments
 (0)