swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

Swiftly is incompatible with Swift shipped in Xcode

Open gregcotten opened this issue 9 months ago • 8 comments

Swiftly needs functionality to let the user switch between Xcode and the Open-Source Swift toolchains. If a user installs swiftly today on macOS, any use of swift from the command line will only ever use the currently selected Swiftly-selected toolchain.

gregcotten avatar Apr 03 '25 22:04 gregcotten

There should be some kind of way to disable swiftly so I can see my Xcode toolchain. I just want to swiftly disable or swiftly enable if there isn't going to be interoperability with existing toolchains through Xcode (due to portability between platforms ...).

My only workaround is to comment the swiftly ~/.zprofile addition and reload my zsh shell, just like I can comment out my $TOOLCHAINS=... line when doing Embedded Swift.

# Set the toolchain to the latest installed:
# export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist)

If you have an open Terminal window, you'll probably also need to unset TOOLCHAINS:

export TOOLCHAINS=""

PaulSolt avatar Apr 05 '25 17:04 PaulSolt

There should be some kind of way to disable swiftly so I can see my Xcode toolchain. I just want to swiftly disable or swiftly enable if there isn't going to be interoperability with existing toolchains through Xcode (due to portability between platforms ...).

My only workaround is to comment the swiftly ~/.zprofile addition and reload my zsh shell, just like I can comment out my $TOOLCHAINS=... line when doing Embedded Swift.

# Set the toolchain to the latest installed:
# export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist)

swiftly enable / swiftly disable is probably a good feature overall anyway! Kind of like brew link / brew unlink, it gives the user maximum freedom with their PATH, linker search paths, etc.

Probably any attempt of using swiftly when disabled should at least prompt the user about it, if not outright fail on "swiftly use"

gregcotten avatar Apr 05 '25 17:04 gregcotten

I don't know if it's relevant, but it seems like toolchain installed via Swiftly breaks code completion in Xcode (in VSCode it works well though)

kirilltitov avatar Apr 06 '25 14:04 kirilltitov

I assume #315 fixes this issue?

louisunlimited avatar May 05 '25 05:05 louisunlimited

It would be great to be able to select the Xcode swift from swiftly as well, instead of having to link and unlink swiftly

JaapWijnen avatar Aug 11 '25 09:08 JaapWijnen

This should be fixed by https://github.com/swiftlang/swiftly/pull/317. Can you try running swiftly use xcode with a top-of-tree Swiftly and let us know if that works for you? Thanks.

etcwilde avatar Aug 11 '25 16:08 etcwilde

ah that should do the trick. I'll try it when I get some time!

JaapWijnen avatar Aug 13 '25 15:08 JaapWijnen

I did try and it worked. I can switch to xcode. But I have question - I see that dev version is 1.2.0-dev, but last released is 1.0.1... May be it is time to make proper release? So we can use this funtionality without building swiftly from dev.

NikolayJuly avatar Oct 11 '25 18:10 NikolayJuly