Skip to content

Bug: Unable to run SwiftUI preview in ./examples/integration project #3189

@jeffhodsdon

Description

@jeffhodsdon

Description

Apologies with two bug reports, however I think they might be relevant given these are experienced on a clean repo's examples

Image

I am experiencing this SwiftUI preview issue on ./examples/integration —

== PREVIEW UPDATE ERROR:

    FailedToAnalyzeBuiltTargetDescription: Could not analyze the built target description for UI to create the preview.
    
    buildableName: UI
    
    ==================================
    
    |  CouldNotParseLinkCommandLine: Could not parse linker command line.
    |  
    |  Full linker invocation:
    |    /Users/j/git/rules_xcodeproj/examples/integration/Integration.xcodeproj/rules_xcodeproj/bazel/ld
    |    -Xlinker
    |    -reproducible
    |    -target
    |    arm64-apple-ios15.0-simulator
    |    -dynamiclib
    |    -isysroot
    |    /Applications/Xcode-16.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk
    |    -O0
    |    -L/Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator
    |    -F/Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator
    |    -filelist
    |    /Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Intermediates.noindex/Integration.build/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd/bin/UI/UIFramework.iOS/Objects-normal/arm64/UIFramework.iOS.LinkFileList
    |    -dead_strip
    |    -Xlinker
    |    -object_path_lto
    |    -Xlinker
    |    /Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Intermediates.noindex/Integration.build/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd/bin/UI/UIFramework.iOS/Objects-normal/arm64/UIFramework.iOS_lto.o
    |    -Xlinker
    |    -no_deduplicate
    |    -fapplication-extension
    |    -fobjc-link-runtime
    |    -L/Applications/Xcode-16.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
    |    -L/usr/lib/swift
    |    -Xlinker
    |    -add_ast_path
    |    -Xlinker
    |    /Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Intermediates.noindex/Integration.build/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd/bin/UI/UIFramework.iOS/Objects-normal/arm64/UI.swiftmodule
    |    @/Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Intermediates.noindex/Integration.build/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd/bin/UI/UIFramework.iOS/DerivedSources/link.params
    |    -Xlinker
    |    -dependency_info
    |    -Xlinker
    |    /Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Intermediates.noindex/Integration.build/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd/bin/UI/UIFramework.iOS/Objects-normal/arm64/UIFramework.iOS_dependency_info.dat
    |    -o
    |    /Users/j/Library/Developer/Xcode/DerivedData/Integration-bghpkrhtmhauwshjrzrmqeigzklq/Build/Products/Debug-iphonesimulator/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd/bin/UI/UIFramework.iOS.framework/UIFramework.iOS
    |  
    |  
    |  ==================================
    |  
    |  |  CouldNotParseInput
    |  |  
    |  |  ==================================
    |  |  
    |  |  |  FailedParsingMachObjectFile
    |  |  |  
    |  |  |  MachO data could not be parsed for: arm64-apple-ios15.0-simulator
    |  |  |  Reason: Underlying failure reading data
    |  |  |  Data header bytes: []
    |  |  |  Data header ASCII: "<nil>"
    |  |  |  
    |  |  |  ==================================
    |  |  |  
    |  |  |  |  NSError.NSCocoaErrorDomain.260: The file “arm64-apple-ios15.0-simulator” couldn’t be opened because there is no such file.
    |  |  |  |  
    |  |  |  |  NSCocoaErrorDomain (260):
    |  |  |  |  ==NSURL: arm64-apple-ios15.0-simulator -- file:///
    |  |  |  |  ==NSFilePath: /arm64-apple-ios15.0-simulator
    |  |  |  |  
    |  |  |  |  ==================================
    |  |  |  |  
    |  |  |  |  |  NSError
    |  |  |  |  |  
    |  |  |  |  |  NSError: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"



== VERSION INFO:

    Tools: 16A242d
    OS:    24F74
    PID:   40272
    Model: MacBook Pro
    Arch:  arm64e



== ENVIRONMENT:

    openFiles = [
        /Users/j/git/rules_xcodeproj/examples/integration/UI/ContentView.swift
    ]
    wantsNewBuildSystem = true
    newBuildSystemAvailable = true
    activeScheme = UIFramework.iOS
    activeRunDestination = iPhone 16 Pro variant iphonesimulator arm64
    workspaceArena = [x]
    buildArena = [x]
    buildableEntries = [
        UIFramework.iOS.framework
    ]
    runMode = JIT Executor



== SELECTED RUN DESTINATION:

    Simulator - iOS 18.0 | iphonesimulator | arm64 | iPhone 16 Pro | no proxy



== EXECUTION MODE OVERRIDES:

    Workspace JIT mode user setting: true
    Falling back to Dynamic Replacement: false



== PACKAGE RESOLUTION ERRORS:

    



== REFERENCED SOURCE PACKAGES:

    



== JIT LINKAGE:

    



== SESSION GROUP 5250:

    workspace identifier: WorkspaceIdentifier(identifier: 5EE78774-A80F-47C2-B844-7B1D58018DA1)
    providers: [
        Preview Provider | ContentView_Previews provider #1 in ContentView.swift [Editor(5187)]
    ]
    translation units: [
        /Users/j/git/rules_xcodeproj/examples/integration/UI/ContentView.swift
    ]
    attributes: [
        Editor(5187):     []
    ]
    session: 5251
    request sessions: [
        ContentView_Previews provider #1 in ContentView.swift: not completed
    ]



== UPDATE SESSION 5251:

    Start Date: Wednesday, June 11, 2025 at 10:57:59 Central European Summer Time
    Preview Provider {
        Simulator {
            platform: none
            device: 49A3EB74-3DD0-4C6E-AE45-A9A97A2FFEDF iPhone 16 Pro
            buildNumber: 23A5260l
            runtimePath: /Library/Developer/CoreSimulator/Volumes/iOS_23A5260l/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.0.simruntime
        }
    }
    Build Graph {
        UIFramework.iOS.framework (#3)
           sourceFile(file:///Users/j/git/rules_xcodeproj/examples/integration/UI/ContentView.swift -> ContentView.swift) (#1)
           ContentView.swift (#2)
    }
    Update Plan {
        iOS [arm64 iphonesimulator18.0 iphonesimulator] (iPhone 16 Pro, 717FA606-3B3A-4FD2-917C-66B4709FBD55-iphonesimulator18.0-arm64-iphonesimulator), [], thinning disabled, thunking enabled) {
            Destination: iPhone 16 Pro 717FA606-3B3A-4FD2-917C-66B4709FBD55 | default device for iphonesimulator [
                Framework Agent - Previews {
                    execution point packs [
                        [source: ContentView.swift, role: Previews] (in UI)
                    ]
                    translation units [
                        ContentView.swift (in UIFramework.iOS.framework)
                    ]
                    loadable products [
                        Description(buildableName: "UIFramework.iOS.framework", moduleName: "UI")
                    ]
                    modules [
                        UIFramework.iOS.framework
                    ]
                    jit link description [
                        UIFramework.iOS.framework
                    ]
                }
            ]
        }
    }

Reproduction steps

git clone [email protected]:MobileNativeFoundation/rules_xcodeproj.git
cd examples/integration
xcodes select 16.0
bazelisk run //:xcodeproj-incremental-bazel-sim_arm64
xed .
  • Select UIFramework as a build target
  • Run SwiftUI preview in ./UI/ContentView.swift

Expected behavior

SwiftUI preview to run

rules_xcodeproj version

main

Xcode version

16.0 via xcodes

Bazel version

8.2.1 via bazelisk

rules_apple version

No response

rules_swift version

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions