Hello, I encountered something that seems like a bug in XCode/Swift that's easy to reproduce:
in a swift Package, depending on the supported platform, I get a crash upon tapping the button in a preview. iOS 14 -> Crash iOS 15 + -> No issue
here is the package.swift
for repro
import PackageDescription
let package = Package(
name: "PreviewCrashDemo",
platforms: [.iOS(.v14)], // Changing this to iOS 15 fixes the crash ><
products: [
.library(
name: "PreviewCrashDemo",
targets: ["PreviewCrashDemo"]),
],
dependencies: [],
targets: [
.target(
name: "PreviewCrashDemo",
dependencies: []),
]
)
And here is the code for my preview:
struct Test_Previews: PreviewProvider {
static var previews: some View {
Button("Hello world") {
Task {
print("Hi!")
}
}
.previewDisplayName("Crash on iOS 14")
}
}