swiftuipreviewxcode15

SwiftUI Preview Error for "New build system required"


My Environment is: Xcode 15.0 Swift5 Minimum Deployments: iOS 13 My project is UIKit, but when I use SwiftUI file, I get an error is "New build system required", how to fix it? enter image description here

I can't find where to modify New build system, there is my WorkSpace Settings: WorkSpace setting

That's full diagnostics from Preview

== DATE:

Friday, October 25, 2024 at 17:14:41 China Standard Time

2024-10-25T09:14:41Z

== PAUSED REASON:

initial

== PENDING UPDATE REASONS:

Data Sources changed
Data Sources changed
Data Sources changed
Open file was edited
Preview Settings changed
Current scheme changed
Current scheme changed
Preview Settings changed
Open file was edited
Workspace build settings changed
Workspace build settings changed
Preview Settings changed

== PREVIEW UPDATE ERROR:

NeedXCBuildError: New build system required

The new build system is required for using Xcode previews

== VERSION INFO:

Tools: 15C500b
OS:    22H123
PID:   7674
Model: Mac mini
Arch:  arm64e

== ENVIRONMENT:

openFiles = [
    /Users/kim/Desktop/TradeBook_App/TradeBook/NewWidget/EmptyDataView.swift
]
wantsNewBuildSystem = false
newBuildSystemAvailable = true
activeScheme = TradeBook
activeRunDestination = Any iOS Device variant iphoneos undefined_arch
workspaceArena = [x]
buildArena = [x]
buildableEntries = [
    NewWidgetExtension.appex
]
runMode = Dynamic Replacement

== SELECTED RUN DESTINATION:

name = Any iOS Device
eligible = false
sdk = Optional(<DVTSDK:0x142722fe0:'iphoneos17.2':iOS 17.2:<DVTFilePath:0x6000023f3020:'/Users/kim/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk'>>)
variant = Optional("iphoneos")
device = Optional(<DVTiPhonePlaceholder: 0x14272f140 (Any iOS Device | undefined_arch)>)

== POWER STATE LOGS:

2024/10/25, 17:09 Received power source state: Externally Powered
2024/10/25, 17:09 No device power state user override user default value.Current power state: Full Power

Solution

  • I just ran into the same issue and it turned out to be an old workspace build setting that no longer appears to be exposed in Xcode GUI (located in file: workspace_name.xcworkspace -> xcshareddata -> WorkspaceSettings.xcsettings). I deleted the xcsettings file completely and Xcode now working as expected.

    enter image description here