This is the source code and documentation for a cross-platform macOS/Windows application implemented in Swift 6. It’s an LLM client. I’ve been playing with it for some time in my spare time and I’m happy to share it publicly now! https://github.com/fbarbat/fellmonger
My main goal was to learn about architectural patterns and developer experience for cross-platform Swift. I found some really cool pointers from The Browser Company and @compnerd about how that was possible and how to get started but I still felt like I needed deeper hands-on experience.
How would “real life” Swift Windows code look like? How would the developer experience be? What would be shareable and what wouldn't? How would be a Swift Windows app be released and packaged? What would be the major trade offs when following this approach? How would Swift 6 fit in all of this?
I tried to condense down everything I learned about cross-platform Swift in this GitHub repo. If you have questions please let me know! Happy to improve it so we can all have more learning resources in the Swift community about how to follow this cool approach. Let me know if you have any thoughts about it!
I would love to give this a try but it's exposing how outdated my Windows skills are
I've got a Windows machine with Swift 5.10 (which I believe I installed via winget, if that matters) but I've seen your Package.swift files are tools-version: 6.0.
So I downloaded Swift 6 and ran the installer - but I'm not sure how to actually switch Swift versions on Windows! When I run swift --version in a shell it still reports 5.10.
On macOS I use Xcodes or xcode-select - or even just env DEVELOPER_DIR=... xcrun swift but I don't even know where things get installed on Windows.
What's the recommended way to deal with multiple Swift versions on Windows?
I haven't tried having multiple versions of Swift at the same time in Windows. The easiest thing to do is to make sure you uninstall them all (be it from an uninstaller and/or winget) and only install the most recent one for Swift 6, which is this one as of now. Note I stuck to the Browser Company toolchain of Swift since that’s why they suggested in their examples. It might work with the official one but I haven tried it yet.
If you really need to keep more than one installation, you could write a batch script that changes the path accordingly but probably not worth if you are just testing out this tech.
You should verify the PATH in the environment variables is pointing to the right directory.
I have ventured to experiment with swift 6 on a windows 11 vm that runs in a Mac M1 chip (ARM)
I have followed the simple install instructions using either manual config or widget cli.
And I can't get "swift build" on a simple hello world.
You need to install Microsoft Visual C++ (MSVC) for Swift on Windows to work properly.
You should download Visual Studio Community and install Desktop Development with C++ to get it. Probably there are lighter ways to do it but this should work for most people.
I could reproduce your same issue by running the below commands but then got it working after installing the above stuff.
mkdir test
cd test
swift package init
swift build
Be aware that Swift on Windows for ARM was not fully supported when I wrote my project. I hit several issues when trying it and fell back to using an X86_64 Windows machine or a VM in Intel MacBook. Check the README of my project for more details.
In that README I also mention more details about setting up the development environment.
I can confirm swift runs all right on a windows 11 vm on intel.
The desire to make it work on ARM is obviously related to that really cool Mac silicon.
From what I gather the windows world does not really care much about ARM.