What's the difference between just open Package.swift & use `swift package generate-xcodeproj` then open the generated xcodeproj file?

Viewed 419

I followed the Vapor Website Docs, created hello project. VaporDocs

under hello project path, inputed swift build in terminal. But when open Package.swift, Xcode start to fetch vapor again.

Why? all dependencies repository is in .build path isn't? Why Xcode begains fetch Vapor over again?

swift package generate-xcodeproj can help generate xcode project, it seems like all dependencies is not package anymore. just groups.

What's the difference between just open Package.swift & use swift package generate-xcodeproj then open the generated xcodeproj file?

open Pacakge.swift with Xcode, fetch Vapor very slow. is there any better way?

like tell the Xcode everything is just in ./build path.

1 Answers

When you work with a project in terminal you use commands like

swift package update
swift build
swift run
swift package generate-xcodeproj

these commands works with hidden .build folder and Xcode project generated by swift package generate-xcodeproj works with that .build folder too. The only disadvantage of xcodeproj that if you change Package.swift or manually(outside of Xcode) add/delete some files from Sources folder then you have to run either just swift package generate-xcodeproj or swift package update && swift package generate-xcodeproj.

When you open project by double clicking on Package.swift it not uses classic xcodeproj anymore, now it is fully dynamic and you could edit Package.swift and files on-the-fly, doesn't matter in Xcode or in Finder, it will track all the changes. Though it sounds cool it works not perfectly and I still prefer classic xcodeproj cause it is not really hard to execute swift package generate-xcodeproj when needed. As far as I know there is no way to say Xcode to use .build folder in dynamic mode, it uses DerivedData folder to store dependencies.

Related