Skip to content

Previews broken when adding FluentUI through SPM #2050

Open
@spelaez

Description

@spelaez

Environment Information

  • Platform:
    • [x ] iOS
    • macOS
  • Package version(s): 0.28.0
  • Xcode and OS versions: Xcode 15.4 and Xcode 16 beta.

Please provide a reproduction of the bug:

  • Create a Swift Package
  • Add fluentUI as dependency in the Package.swift file
  • In the autogenerated swift file on the package, create a basic preview with any text
  • Try to run the preview

Actual behavior:

Previews can't run, with the following error

Xcode 16.0 Beta

== PREVIEW UPDATE ERROR:

    StubError
    
    StubError: could not generate preview info: unableToFindTarget

Xcode 15.4 fails, because even though the Package is specified as iOS only it tries to build the macOS version of Fluent, this however, seems to be a bug of Xcode 15.x

Expected behavior:

Adding FluentUI shouldn't break previews

Priorities and help requested:

Requested priority: Normal

Here's my Package.swift if it helps

// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
  name: "FluentTest",
  platforms: [.iOS(.v16)],
  products: [
    .library(
      name: "FluentTest",
      targets: ["FluentTest"]),
  ],
  dependencies: [
    .package(url: "https://github.com/microsoft/fluentui-apple.git", .upToNextMinor(from: "0.28.0"))
  ],
  targets: [
    .target(
      name: "FluentTest",
      dependencies: [
        .product(name: "FluentUI", package: "fluentui-apple")
      ]
    ),
    .testTarget(
      name: "FluentTestTests",
      dependencies: ["FluentTest"]
    )
  ]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions