Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Swift Playgrounds 4.6 removes support for libraries?

I had several library projects that were working in Swift Playgrounds < 4.6 but I get several duplicate compilation errors and previews will not build in Swift Playgrounds > 4.6. Does anyone know how to fix this issue?

Example project: This project builds and runs fine under Swift Playgrounds 4.5.1 however it will not run complaining multiple commands produce generated output files under Swift Playgrounds 4.6.1, 4.6.2, and 4.6.3.

https://github.com/kudit/Compatibility

Download this repository and add the extension ".swiftpm" to the folder and double click to open in Swift Playgrounds. If running on earlier Swift Playgrounds you can see there are no errors and previews work great (on both macOS and iPadOS versions of Swift Playgrounds 4.5.x). However, on Swift Playgrounds 4.6.x, previews will not display.

Are embedded libraries not support anymore? This would be very disappointing.

I posted this as a Feedback weeks ago with no response: FB16509699

It appears that this is happening because the Package.swift has a module target and an app product with the same name (Compatibility). If I change the name of the app product to "CompatibilityApp", then everything compiles correctly in Swift Playground 4.6.2. Can you see if this change works around the issue for you as well? Thanks!

This worked for Swift Playground 4.6.2, but starting in Swift Playground 4.6.4 whenever this package is included in another swift playground, the new playground silently fails compilation (will not show previews). Works fine in Xcode and worked fine in 4.6.2 and 4.6.3... (issue reported under FB17377610)

Are there any updates here?

They said 4.6.4 would remove the errors, however, #Previews still do not work when including modules with included app executable targets. Apparently Swift Playgrounds is not choosing the correct root app.

Swift Playgrounds 4.6 removes support for libraries?
 
 
Q