Swift Packages

RSS for tag

Create reusable code, organize it in a lightweight way, and share it across Xcode projects and with other developers using Swift Packages.

Posts under Swift Packages tag

128 Posts

Post

Replies

Boosts

Views

Activity

Behavior change for `.copy(...)` in SPM packages in Xcode 27 causes resources in packages to not properly compile resulting in missing resources
It seems that the behavior of the .copy rule in SPM packages has changed in Xcode 27. This change now results in raw files being copied into the bundle without compilation, resulting in crashes and missing resources since uncompiled resources cannot be used by the OS. More specifically, in Xcode 26, when .copy was applied to resources such as storyboards, asset catalogs, etc. it would cause Xcode to compile those resources into the respective storyboardc or Assets.car before copying. Xcode 27 does not do this and instead copies the raw files. I do understand that there is a difference between .process and .copy, and the documentation does state that the process rule needs to be used for those files. Is this a regression in Xcode 27 or is copy not compiling anything expected behavior? Submitted FB23115950
0
0
23
2d
Apple packages fail to build for watchOS in Xcode 27
Is there a known workaround (other than forking) for watchOS builds in Xcode 27 that depend on packages without a declared watchOS 9.0 floor? I depend on several Apple SPM packages with no minimum deployment target, such as https://github.com/apple/swift-algorithms. My project's minimum is 26.0. Xcode 27 will not build watchOS targets with these packages because watchOS 8.0 is below its range of supported targets. /.../SourcePackages/checkouts/swift-algorithms/Package.swift The watchOS Simulator deployment target 'WATCHOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 27.0.x.
4
16
284
4d
SPM packages fail for watchOS Xcode 27
Xcode 27 refuses to build common Swift Packages for watchOS, such as swift-algorithms or swift-collections. ... 'WATCHOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 27.0.x. The error disappears by explicitly declaring in the SPM manifest "platforms: [.watchOS(.v9)]". (Patching the "SwiftStdlib" availabilities in swift-collections is insufficient.) Is there a better workaround than mirroring our whole SPM graph to declare the platform minimum? Our projects' minimums are correctly set at 11 or 26. (Also happens in the hello world Xcode 27 watchOS only project.) FB23037701 ref: https://developer.apple.com/forums/thread/829540
2
1
94
4d
Me
import AVFoundation var player: AVAudioPlayer? func playBackgroundAudio() { do { try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) try AVAudioSession.sharedInstance().setActive(true) } catch { print("Audio session setup failed: (error)") } if let url = Bundle.main.url(forResource: "background_music", withExtension: "mp3") { do { player = try AVAudioPlayer(contentsOf: url) player?.numberOfLoops = -1 player?.play() } catch { print("Error playing audio: \(error)") } } } playBackgroundAudio()
1
0
427
1w
Build plugin warnings not showing in issue navigator
With Xcode 26.5, I've switched from using SwiftLint in a "Run Script" phase to using the SwiftLintPlugins package and running it as a build plugin. This works fine on one Mac, in a small project, where the warnings from the build plugin show up in the issue navigator as expected. But on another Mac, in a large project, I can see the SwiftLint build plugin warnings in the build log but they don't appear in the Xcode issue navigator. Is there some Xcode setting that could influence this, or what else can I check?
0
0
90
2w
Multiple xcode Build Fail errors
Has anybody had encountered these build fail issues in xcode: Type ‘Constants’ has no member ‘AdmobinterstitialID’’; type ‘Constants’ has no member ‘admobadstriggerurls’;type ‘Constants’ has no member ‘fbadstriggerurls’, cannot find ‘cancelbutton’ in; cannot find ‘autoInjectVariable in scope; cannot find ‘enableBioAuth’ in scope;cannot find ‘statusBarBackgroundColor’ in scope;cannot find ‘deletecacheonexit’ in scope; cannot find ‘loadingIndicatorColor’ in scope; cannot find ‘status ‘statusBarTextColor’ in scope;cannot find ‘bottombar’ in scope; And they are all tied to AppConfig. swift And if so, how did you resolve it?
0
0
66
2w
Add Swift Package in Xcode
Hi, Overview I would like to add a Swift Package to my Xcode project. Problem In Xcode when I select Project > Package Dependencies and Press + button to add a dependency it keeps spinning and doesn't end Points to note: Xcode 26.5 (17F42) macOS 26.5 (25F71) This is a private GitHub repository I am able to clone the Swift Package URL on the command line. Xcode has the GitHub account I am able to push and pull code on that GitHub account using Xcode My failed attempt rm -rf ~/Library/Developer/Xcode/DerivedData rm -rf ~/Library/Caches/org.swift.swiftpm plutil -remove IDESwiftPackageAdditionAssistantRecentlyUsedPackages ~/Library/Preferences/com.apple.dt.Xcode.plist I have removed GitHub account in Xcode and added it again I am confused if I am missing something very obvious, any help on this is much appreciated. Questions Is there any workaround or way to fix this issue? Why does this take such a long time when I have a specific URL, either it needs to add it or return that the package is not found. Why is it searching?
2
0
180
2w
App Review Guidelines 2.5.1 / 2.5.2 — official guidance on screen capture protection for sensitive content
Hi all, We are developing an iOS app that includes private user-to-user chats, commercial offer details with monetary value, and customer identification data. In line with OWASP MASVS-PLATFORM-3 requirements regarding unintentional sensitive data exposure, we need to protect these specific screens from screenshots and screen recording. We have carefully reviewed the relevant App Review Guidelines (2.5.1 on public APIs, 2.5.2 on self-contained bundles, 5.1.1 on privacy) and the related Human Interface Guidelines. From this analysis we have observed the following: iOS does not expose a public API to globally disable screen capture (no direct equivalent of Android's FLAG_SECURE). The SwiftUI .privacySensitive() modifier is effective for Lock Screen widgets and Always-On Display, but it does not appear to prevent screenshots or screen recording of an app's main UI while in the foreground. A number of widely distributed App Store apps (banking, authenticator, secure messaging) implement some form of screenshot protection on sensitive screens. Several established open-source libraries leverage the system behavior of UITextField with isSecureTextEntry as a wrapping container for arbitrary views, in order to achieve pixel-level protection for sensitive content. We would appreciate clarification on the following points: For privacy-driven protection of sensitive screens (private chats, customer data, monetized offers), is there an officially recommended approach we may have missed? Are there public APIs intended specifically for this use case beyond .privacySensitive()? Is the practice of leveraging UITextField with isSecureTextEntry as a wrapping container for arbitrary views considered an acceptable use of public APIs under Guideline 2.5.1, or does it carry App Review risk? Are there official recommendations or documentation for apps handling sensitive personal data that wish to align with industry standards such as OWASP MASVS-PLATFORM-3 for screenshot and screen recording leakage prevention? The intended use is strictly limited to a small number of screens marked as containing sensitive data (private messages, deal details, customer information). The protection would be selective and clearly communicated to the user via in-app messaging, not global to the app. Thanks in advance for any clarification, including pointers to existing documentation or threads we may have missed. Deployment target: iOS 15+
5
0
949
3w
Xcode 26 fails to load SPM packages
For me it looks like Xcode 26 has problems reading SPM packages from a locally hosted BitBucket git solution. While Xcode 16 work perfectly fine, Xcode 26 fails to load and gives "Server SSH Fingerprint Failed to Verify" as error description. Cleaning build data and DerivedData sometimes makes loading work. Any change in Package dependencies will break it again. Anyone having same problems? How do you handle it?
13
10
1.8k
May ’26
Could not load Xcode Cloud Data
Hello, I have Xcode Cloud set up on a project with multiple targets. One target is a Framework that hosts a Swift Package that's used to host modules. I recently added a large number of files (at least 20,000) to some test targets and I can no longer access Xcode Cloud from the Cloud Reports section. Xcode prepares to analyze the project and then fails with Could not load Xcode Cloud Data Removing the files from the package results in the project being analyzed successfully. So it appears to be some sort of a timeout issue. Thank you
0
0
369
May ’26
String Catalogs auto-generated symbols located in Swift Packages with default Main Actor isolation don't compile with Xcode 26.4
Hello, I've already reported this issue via Feedback Assistant a month ago (FB22340897) but it's still open and I'd like to know whether I can expect something to be changed regarding it. Here are the details: It seems that Xcode 26.4 started specifying nonisolated for the resourceBundleDescription in the generated stringSymbols files for Swift packages: from: private let resourceBundleDescription = LocalizedStringResource.BundleDescription.atURL(resourceBundle.bundleURL) to: private nonisolated let resourceBundleDescription = LocalizedStringResource.BundleDescription.atURL(resourceBundle.bundleURL) This causes a compilation error: Main actor-isolated default value in a nonisolated context when the Package.swift for the Swift Package in which the string catalog is located specifies: swiftSettings: [.defaultIsolation(MainActor.self)] Since all tools (String Catalogs, Swift Packages and default actor isolation to be Main Actor) are recommended by Apple, I believe it should be possible to use all these together like before Xcode 26.4.
1
0
1.1k
Apr ’26
Previews for SwiftUI views in Packages don't work in Xcode 26.4
I have an iOS project based on SwiftUI in which almost all code is organised in Packages. With Xcode 26.2 and 26.3, I can preview all SwiftUI views without issues. With Xcode 26.4, the same previews don't work, in the canvas appears this error message: "Cannot preview in this file. Could not find target description for “TaskListView.swift”". The explanation is: "The list of source files that produce object files did not contain this file to be previewed. Check to make sure it is not excluded using the EXCLUDED_SOURCE_FILE_NAMES build setting." If I add a SwiftUI view to the main project files (not in a package), the preview works as expected. Is it an Xcode 26.4 regression? Or do I need to modify some configuration file?
6
0
527
Apr ’26
Xcode 26 beta 5 xcodebuild crash
Good day! When your project have total 887 or more SPM local targets and then you try to build it, xcodebuild will be crash. Crash log: SWBBuildService-2025-08-11-151103.ips Thread 2 Crashed:: Dispatch queue: com.apple.root.default-qos.cooperative 0 libxpc.dylib 0x197c4826c _availability_version_check + 8 1 libswiftCore.dylib 0x1a9b44428 __isPlatformVersionAtLeast + 92 2 libswiftCore.dylib 0x1a9a6e054 _swift_allocObject_ + 1100 3 SWBMacro 0x104a9c408 specialized _ArrayBuffer._consumeAndCreateNew(bufferIsUnique:minimumCapacity:growForAppend:) + 116 4 SWBMacro 0x104a97b58 specialized Array.append<A>(contentsOf:) + 116 5 SWBMacro 0x104a954e8 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 160 6 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 7 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 8 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 9 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 10 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 But if you try to build Package.swift via swift build command, it works. Here you can open sample project: Just Package.swift with SPM 900 targets Open Package.swift via Xcode 26 any beta and try to build Xcode workspace with SPM 900 targets Open MyApp.xcworkspace and try to build You can also make by self the Package.swift (also make required directories for SPM): // swift-tools-version: 5.9 import PackageDescription // let count = 800 // no crash let count = 900 // crash let targetsNames = (1...count).map { "Pkg1Target\($0)" } let targets = targetsNames.map { Target.target(name: $0) } let package = Package( name: "Pkg1TargetLibrary", platforms: [.iOS(.v16)], products: [ .library(name: "Pkg1TargetLibrary", targets: targets.map(\.name)), ], targets: targets )
6
1
624
Apr ’26
Previews crash after making change to Swift Package version
Previews seemed to be working okay. However, I wanted to test out some changes inside of a package that I'm working on for work, but in a lighter project since in our main project (where I have the package pulled in locally for now) is just too big to have the previews render in a decent amount of time. So, I opened a small project that was already importing that package and was set to 'Up to Next Major', but I switched that to 'branch' and added my branch. This is the second time I've done that and it causes Xcode to freak out in terms of the previews. This is the code I have: import SwiftUI extension EnvironmentValues { @Entry var trailingDescriptionColorToken: Color = .secondary } extension View { func updateTrailingDescriptionColor(to colorToken: Color, when trigger: Bool) -> some View { environment(\.trailingDescriptionColorToken, trigger ? colorToken : .secondary) } } // MARK: - ListItemDescription public struct ListItemDescription: View { @Environment(\.trailingDescriptionColorToken) var trailingDescriptionColorToken let description: String init(_ description: String) { self.description = description } public var body: some View { Text(description) .font(.caption) .foregroundStyle(trailingDescriptionColorToken) } } struct ContentView: View { @State private var isError = false var body: some View { VStack { Button("Error Trigger") { isError.toggle() } ListItemDescription("Description") .updateTrailingDescriptionColor(to: .red, when: isError) } .padding() } } #Preview { ContentView() } As soon as I tap the button to toggle the isError state property, that causes the preview canvas to indefinitely load and spin eventually leading to a crash. This is infuriating as I've just wasted a ton of time at work trying to figure out what's going on. Xcode and SPM is so fragile and delicate that at this point I feel like if I breathe on it wrong it'll break. I'm not sure what fixed it last time. Nothing in Xcode makes sense anymore. How to I resolve this please?
0
0
70
Apr ’26
Undefined symbol
Is anyone have this problem on xcode 26 ? Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibility50 Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibility51 Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibility56 Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibilityConcurrency Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibilityDynamicReplacements
2
1
2.3k
Apr ’26
Behavior change for `.copy(...)` in SPM packages in Xcode 27 causes resources in packages to not properly compile resulting in missing resources
It seems that the behavior of the .copy rule in SPM packages has changed in Xcode 27. This change now results in raw files being copied into the bundle without compilation, resulting in crashes and missing resources since uncompiled resources cannot be used by the OS. More specifically, in Xcode 26, when .copy was applied to resources such as storyboards, asset catalogs, etc. it would cause Xcode to compile those resources into the respective storyboardc or Assets.car before copying. Xcode 27 does not do this and instead copies the raw files. I do understand that there is a difference between .process and .copy, and the documentation does state that the process rule needs to be used for those files. Is this a regression in Xcode 27 or is copy not compiling anything expected behavior? Submitted FB23115950
Replies
0
Boosts
0
Views
23
Activity
2d
Apple packages fail to build for watchOS in Xcode 27
Is there a known workaround (other than forking) for watchOS builds in Xcode 27 that depend on packages without a declared watchOS 9.0 floor? I depend on several Apple SPM packages with no minimum deployment target, such as https://github.com/apple/swift-algorithms. My project's minimum is 26.0. Xcode 27 will not build watchOS targets with these packages because watchOS 8.0 is below its range of supported targets. /.../SourcePackages/checkouts/swift-algorithms/Package.swift The watchOS Simulator deployment target 'WATCHOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 27.0.x.
Replies
4
Boosts
16
Views
284
Activity
4d
SPM packages fail for watchOS Xcode 27
Xcode 27 refuses to build common Swift Packages for watchOS, such as swift-algorithms or swift-collections. ... 'WATCHOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 27.0.x. The error disappears by explicitly declaring in the SPM manifest "platforms: [.watchOS(.v9)]". (Patching the "SwiftStdlib" availabilities in swift-collections is insufficient.) Is there a better workaround than mirroring our whole SPM graph to declare the platform minimum? Our projects' minimums are correctly set at 11 or 26. (Also happens in the hello world Xcode 27 watchOS only project.) FB23037701 ref: https://developer.apple.com/forums/thread/829540
Replies
2
Boosts
1
Views
94
Activity
4d
Unable to archive xcode project due to signing error
Hi, I'm trying to archive my xcode project. There is a build error. Warning: unable to build chain to self-signed root for signer "Apple Development: JOHN WILLIAM BAKER (VCZ7S72JNR)"
Replies
0
Boosts
0
Views
44
Activity
5d
Xcode 27: Can build any project with WatchOS target and SPM packages
I get this error for every APM package that targets WatchOS, but the package did not set any versions: The watchOS Simulator deployment target 'WATCHOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 27.0.x.
Replies
0
Boosts
1
Views
55
Activity
5d
Error Domain=NSOSStatusErrorDomain Code=-1 "kCFStreamErrorHTTPParseFailure / kCFSocketError / kCFStreamErrorDomainCustom / kCSIdentityUnknownAuthorityErr / qErr / telGenericError / dsNoExtsMacsBug / kMovieLoadStateError / cdevGenErr: Could not parse
Can't able to run the Create ML for training and I upgraded to MacOS 26.3 beta and I have tried older and newer
Replies
1
Boosts
0
Views
644
Activity
1w
Me
import AVFoundation var player: AVAudioPlayer? func playBackgroundAudio() { do { try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) try AVAudioSession.sharedInstance().setActive(true) } catch { print("Audio session setup failed: (error)") } if let url = Bundle.main.url(forResource: "background_music", withExtension: "mp3") { do { player = try AVAudioPlayer(contentsOf: url) player?.numberOfLoops = -1 player?.play() } catch { print("Error playing audio: \(error)") } } } playBackgroundAudio()
Replies
1
Boosts
0
Views
427
Activity
1w
Build plugin warnings not showing in issue navigator
With Xcode 26.5, I've switched from using SwiftLint in a "Run Script" phase to using the SwiftLintPlugins package and running it as a build plugin. This works fine on one Mac, in a small project, where the warnings from the build plugin show up in the issue navigator as expected. But on another Mac, in a large project, I can see the SwiftLint build plugin warnings in the build log but they don't appear in the Xcode issue navigator. Is there some Xcode setting that could influence this, or what else can I check?
Replies
0
Boosts
0
Views
90
Activity
2w
Multiple xcode Build Fail errors
Has anybody had encountered these build fail issues in xcode: Type ‘Constants’ has no member ‘AdmobinterstitialID’’; type ‘Constants’ has no member ‘admobadstriggerurls’;type ‘Constants’ has no member ‘fbadstriggerurls’, cannot find ‘cancelbutton’ in; cannot find ‘autoInjectVariable in scope; cannot find ‘enableBioAuth’ in scope;cannot find ‘statusBarBackgroundColor’ in scope;cannot find ‘deletecacheonexit’ in scope; cannot find ‘loadingIndicatorColor’ in scope; cannot find ‘status ‘statusBarTextColor’ in scope;cannot find ‘bottombar’ in scope; And they are all tied to AppConfig. swift And if so, how did you resolve it?
Replies
0
Boosts
0
Views
66
Activity
2w
Add Swift Package in Xcode
Hi, Overview I would like to add a Swift Package to my Xcode project. Problem In Xcode when I select Project > Package Dependencies and Press + button to add a dependency it keeps spinning and doesn't end Points to note: Xcode 26.5 (17F42) macOS 26.5 (25F71) This is a private GitHub repository I am able to clone the Swift Package URL on the command line. Xcode has the GitHub account I am able to push and pull code on that GitHub account using Xcode My failed attempt rm -rf ~/Library/Developer/Xcode/DerivedData rm -rf ~/Library/Caches/org.swift.swiftpm plutil -remove IDESwiftPackageAdditionAssistantRecentlyUsedPackages ~/Library/Preferences/com.apple.dt.Xcode.plist I have removed GitHub account in Xcode and added it again I am confused if I am missing something very obvious, any help on this is much appreciated. Questions Is there any workaround or way to fix this issue? Why does this take such a long time when I have a specific URL, either it needs to add it or return that the package is not found. Why is it searching?
Replies
2
Boosts
0
Views
180
Activity
2w
Swift Package Manager authentication failed
Swift Package Manager fails while downloading Firebase SDK. Error: Authentication failed because no credentials were provided. Package: https://github.com/firebase/firebase-ios-sdk.git Already tried: Reset package cache Removed DerivedData Re-added GitHub account Reinstalled Xcode
Replies
0
Boosts
0
Views
97
Activity
3w
App Review Guidelines 2.5.1 / 2.5.2 — official guidance on screen capture protection for sensitive content
Hi all, We are developing an iOS app that includes private user-to-user chats, commercial offer details with monetary value, and customer identification data. In line with OWASP MASVS-PLATFORM-3 requirements regarding unintentional sensitive data exposure, we need to protect these specific screens from screenshots and screen recording. We have carefully reviewed the relevant App Review Guidelines (2.5.1 on public APIs, 2.5.2 on self-contained bundles, 5.1.1 on privacy) and the related Human Interface Guidelines. From this analysis we have observed the following: iOS does not expose a public API to globally disable screen capture (no direct equivalent of Android's FLAG_SECURE). The SwiftUI .privacySensitive() modifier is effective for Lock Screen widgets and Always-On Display, but it does not appear to prevent screenshots or screen recording of an app's main UI while in the foreground. A number of widely distributed App Store apps (banking, authenticator, secure messaging) implement some form of screenshot protection on sensitive screens. Several established open-source libraries leverage the system behavior of UITextField with isSecureTextEntry as a wrapping container for arbitrary views, in order to achieve pixel-level protection for sensitive content. We would appreciate clarification on the following points: For privacy-driven protection of sensitive screens (private chats, customer data, monetized offers), is there an officially recommended approach we may have missed? Are there public APIs intended specifically for this use case beyond .privacySensitive()? Is the practice of leveraging UITextField with isSecureTextEntry as a wrapping container for arbitrary views considered an acceptable use of public APIs under Guideline 2.5.1, or does it carry App Review risk? Are there official recommendations or documentation for apps handling sensitive personal data that wish to align with industry standards such as OWASP MASVS-PLATFORM-3 for screenshot and screen recording leakage prevention? The intended use is strictly limited to a small number of screens marked as containing sensitive data (private messages, deal details, customer information). The protection would be selective and clearly communicated to the user via in-app messaging, not global to the app. Thanks in advance for any clarification, including pointers to existing documentation or threads we may have missed. Deployment target: iOS 15+
Replies
5
Boosts
0
Views
949
Activity
3w
New release
Connected x out in stores 🤖❤️
Replies
0
Boosts
0
Views
224
Activity
May ’26
Xcode 26 fails to load SPM packages
For me it looks like Xcode 26 has problems reading SPM packages from a locally hosted BitBucket git solution. While Xcode 16 work perfectly fine, Xcode 26 fails to load and gives "Server SSH Fingerprint Failed to Verify" as error description. Cleaning build data and DerivedData sometimes makes loading work. Any change in Package dependencies will break it again. Anyone having same problems? How do you handle it?
Replies
13
Boosts
10
Views
1.8k
Activity
May ’26
Could not load Xcode Cloud Data
Hello, I have Xcode Cloud set up on a project with multiple targets. One target is a Framework that hosts a Swift Package that's used to host modules. I recently added a large number of files (at least 20,000) to some test targets and I can no longer access Xcode Cloud from the Cloud Reports section. Xcode prepares to analyze the project and then fails with Could not load Xcode Cloud Data Removing the files from the package results in the project being analyzed successfully. So it appears to be some sort of a timeout issue. Thank you
Replies
0
Boosts
0
Views
369
Activity
May ’26
String Catalogs auto-generated symbols located in Swift Packages with default Main Actor isolation don't compile with Xcode 26.4
Hello, I've already reported this issue via Feedback Assistant a month ago (FB22340897) but it's still open and I'd like to know whether I can expect something to be changed regarding it. Here are the details: It seems that Xcode 26.4 started specifying nonisolated for the resourceBundleDescription in the generated stringSymbols files for Swift packages: from: private let resourceBundleDescription = LocalizedStringResource.BundleDescription.atURL(resourceBundle.bundleURL) to: private nonisolated let resourceBundleDescription = LocalizedStringResource.BundleDescription.atURL(resourceBundle.bundleURL) This causes a compilation error: Main actor-isolated default value in a nonisolated context when the Package.swift for the Swift Package in which the string catalog is located specifies: swiftSettings: [.defaultIsolation(MainActor.self)] Since all tools (String Catalogs, Swift Packages and default actor isolation to be Main Actor) are recommended by Apple, I believe it should be possible to use all these together like before Xcode 26.4.
Replies
1
Boosts
0
Views
1.1k
Activity
Apr ’26
Previews for SwiftUI views in Packages don't work in Xcode 26.4
I have an iOS project based on SwiftUI in which almost all code is organised in Packages. With Xcode 26.2 and 26.3, I can preview all SwiftUI views without issues. With Xcode 26.4, the same previews don't work, in the canvas appears this error message: "Cannot preview in this file. Could not find target description for “TaskListView.swift”". The explanation is: "The list of source files that produce object files did not contain this file to be previewed. Check to make sure it is not excluded using the EXCLUDED_SOURCE_FILE_NAMES build setting." If I add a SwiftUI view to the main project files (not in a package), the preview works as expected. Is it an Xcode 26.4 regression? Or do I need to modify some configuration file?
Replies
6
Boosts
0
Views
527
Activity
Apr ’26
Xcode 26 beta 5 xcodebuild crash
Good day! When your project have total 887 or more SPM local targets and then you try to build it, xcodebuild will be crash. Crash log: SWBBuildService-2025-08-11-151103.ips Thread 2 Crashed:: Dispatch queue: com.apple.root.default-qos.cooperative 0 libxpc.dylib 0x197c4826c _availability_version_check + 8 1 libswiftCore.dylib 0x1a9b44428 __isPlatformVersionAtLeast + 92 2 libswiftCore.dylib 0x1a9a6e054 _swift_allocObject_ + 1100 3 SWBMacro 0x104a9c408 specialized _ArrayBuffer._consumeAndCreateNew(bufferIsUnique:minimumCapacity:growForAppend:) + 116 4 SWBMacro 0x104a97b58 specialized Array.append<A>(contentsOf:) + 116 5 SWBMacro 0x104a954e8 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 160 6 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 7 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 8 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 9 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 10 SWBMacro 0x104a96548 MacroEvaluationProgram.executeInContext(_:withResultBuilder:alwaysEvalAsString:) + 4352 But if you try to build Package.swift via swift build command, it works. Here you can open sample project: Just Package.swift with SPM 900 targets Open Package.swift via Xcode 26 any beta and try to build Xcode workspace with SPM 900 targets Open MyApp.xcworkspace and try to build You can also make by self the Package.swift (also make required directories for SPM): // swift-tools-version: 5.9 import PackageDescription // let count = 800 // no crash let count = 900 // crash let targetsNames = (1...count).map { "Pkg1Target\($0)" } let targets = targetsNames.map { Target.target(name: $0) } let package = Package( name: "Pkg1TargetLibrary", platforms: [.iOS(.v16)], products: [ .library(name: "Pkg1TargetLibrary", targets: targets.map(\.name)), ], targets: targets )
Replies
6
Boosts
1
Views
624
Activity
Apr ’26
Previews crash after making change to Swift Package version
Previews seemed to be working okay. However, I wanted to test out some changes inside of a package that I'm working on for work, but in a lighter project since in our main project (where I have the package pulled in locally for now) is just too big to have the previews render in a decent amount of time. So, I opened a small project that was already importing that package and was set to 'Up to Next Major', but I switched that to 'branch' and added my branch. This is the second time I've done that and it causes Xcode to freak out in terms of the previews. This is the code I have: import SwiftUI extension EnvironmentValues { @Entry var trailingDescriptionColorToken: Color = .secondary } extension View { func updateTrailingDescriptionColor(to colorToken: Color, when trigger: Bool) -> some View { environment(\.trailingDescriptionColorToken, trigger ? colorToken : .secondary) } } // MARK: - ListItemDescription public struct ListItemDescription: View { @Environment(\.trailingDescriptionColorToken) var trailingDescriptionColorToken let description: String init(_ description: String) { self.description = description } public var body: some View { Text(description) .font(.caption) .foregroundStyle(trailingDescriptionColorToken) } } struct ContentView: View { @State private var isError = false var body: some View { VStack { Button("Error Trigger") { isError.toggle() } ListItemDescription("Description") .updateTrailingDescriptionColor(to: .red, when: isError) } .padding() } } #Preview { ContentView() } As soon as I tap the button to toggle the isError state property, that causes the preview canvas to indefinitely load and spin eventually leading to a crash. This is infuriating as I've just wasted a ton of time at work trying to figure out what's going on. Xcode and SPM is so fragile and delicate that at this point I feel like if I breathe on it wrong it'll break. I'm not sure what fixed it last time. Nothing in Xcode makes sense anymore. How to I resolve this please?
Replies
0
Boosts
0
Views
70
Activity
Apr ’26
Undefined symbol
Is anyone have this problem on xcode 26 ? Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibility50 Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibility51 Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibility56 Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibilityConcurrency Undefined symbol: _swift_FORCE_LOAD$_swiftCompatibilityDynamicReplacements
Replies
2
Boosts
1
Views
2.3k
Activity
Apr ’26