I created a brand new swift package, added a simple SwiftUI view, and opened the canvas to view the preview. This all worked great. Then I added a dependency to my package. After adding the dependency previews stop working. Here is my final Package.swift
The app compiles successfully via ⌘B, but the preview fails with the following error.
Code Block // swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyTestPackage", platforms: [ .iOS(.v14), .macOS(.v10_15) ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "MyTestPackage", targets: ["MyTestPackage"]), ], dependencies: [ .package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "0.6.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "MyTestPackage", dependencies: [ .product(name: "ComposableArchitecture", package: "swift-composable-architecture") ]), .testTarget( name: "MyTestPackageTests", dependencies: ["MyTestPackage"]), ] )
The app compiles successfully via ⌘B, but the preview fails with the following error.
Code Block build aborted due to an internal error: planningFailed("multiple configured targets of \'ComposableArchitecture\' are being created for iOS Simulator") ---------------------------------------- SchemeBuildError: Failed to build the scheme "MyTestPackage" unexpected service error: build aborted due to an internal error: planningFailed("multiple configured targets of \'ComposableArchitecture\' are being created for iOS Simulator") Build system information: error: unexpected service error: build aborted due to an internal error: planningFailed("multiple configured targets of \'ComposableArchitecture\' are being created for iOS Simulator")