Link narrower BuddyKit products to fix duplicate Pasteboard class#699
Link narrower BuddyKit products to fix duplicate Pasteboard class#699p-linnane wants to merge 1 commit into
Conversation
|
This is the thing I dislike the most about Swift Package Manager. It's supposed to catch this sort of thing and turn the products into dynamic libraries when multiple targets link against them, but apparently it doesn't work reliably 😞
PreviewBugFix is activated automatically by the runtime, it's never referenced explicitly. Have you tested SwiftUI previews to make sure that the bug it is meant to fix is no longer an issue in recent Xcode versions? |
Signed-off-by: Patrick Linnane <patrick@linnane.io>
71b2c69 to
fdd5156
Compare
|
Good catch, you were right about PreviewBugFix being runtime-activated via +load. I must have gotten some wires crossed during testing. I'm using Xcode 27 beta. I updated the split so VirtualUI links the BuddyKit umbrella product, while VirtualCore and the app still link only BuddyFoundation. That keeps BuddyKitObjC/PreviewBugFix loaded once without reintroducing the duplicate class warning. I re-tested with a SwiftUI preview and saw |
Running any VirtualBuddy binary that loads both
VirtualCoreandVirtualUI(includingvctooland the app itself) prints duplicate-class warnings at launch:The cause is that VirtualCore, VirtualUI, the app, and VirtualBuddyGuest all linked BuddyKit's umbrella product, which statically embeds
BuddyPlatform(andBuddyKitObjC) into each binary, so the same classes get registered by more than one loaded image. This PR links only the product each target needs and drops a duplicate BuddyKit package reference.A few call sites that used umbrella-only API were updated to match. This also drops BuddyKit's debug-only
PreviewBugFix, which isn't referenced anywhere in the repo. After the changevctool -hruns clean andnmconfirmsBuddyPlatform.Pasteboardis present only inVirtualUI.framework.