Swift Setup: student-friendly setup instructions for platforms, editors, and IDEs that support Swift

Hi everyone,

I’m happy to be able to share something I’ve been working on for the past weeks: Swift Setup (GitHub - pwsacademy/swift-setup: Student-friendly setup instructions for platforms, editors, and IDEs that support Swift.)

This repository gathers student-friendly setup instructions for platforms, editors, and IDEs that support Swift. The goal of this repository is to support the adoption of Swift as a general purpose cross-platform programming language in (higher) education.

To kickstart the repository, I’ve written instructions for the platforms and editors I’m using in an upcoming programming course, notably Visual Studio Code (with SourceKit-LSP and CodeLLDB) on Ubuntu.

Of course, I’m hoping others will want to contribute (and maintain) instructions for their favorite platforms, editors, and IDEs, so that we can have one central repository that students and instructors can refer to.

Steven

39 Likes

Steven, this is a fantastic resource. I hope it continues to grow and provide newcomers a helpful way to get started for years to come. I particularly appreciate how clearly you delineate which tool versions and platforms the instructions are applicable to, as well as noting the date on which the documents are last updated.

2 Likes

Thanks for your kind words @xwu.

The current list covers the platforms and tools I use myself, so it’s easy for me to maintain. I’m hoping others will jump in to maintain instructions for the platforms and tools they use. This way, we can keep everything up-to-date.

CC @Ron_Olson Fedora?
CC @yeswolf CLion?

Hey @svanimpe! I'd be happy to help; shall I submit a PR with Fedora info?

That would be great thanks! You can use the instructions for Ubuntu as a template.

What's the current status of Swift on Fedora? Does it meet the requirements listed here, or are there still some missing/broken pieces?

Could you also check if the editor instructions for Gedit and Visual Studio Code are applicable to Fedora as well (perhaps with minor changes)?

What's the age of the target student demographic?

I feel like if this is aimed for middle or highschool kids, using the terminal is a non-starter. It scares people.

While Swift can be installed from a package manager GUI on Fedora, the difficulty is that each version (or spin) has their own interface, so describing how to install Swift via the Gnome package manager is going to be different than KDE, Mate, etc.

Besides, if you want to use the REPL you'll have to be familiar with using the terminal.

1 Like

Swift on Fedora (also CentOS/RHEL) works great; it's really as simple as dnf install -y swift-lang and you're on your way. I use it with both VS Code and Vim with Swift plugins and it's a fantastic development experience.

2 Likes

This is definitely not aimed at younger (middle or early high school) students who just want to learn some fundamentals. These students are probably better served by the Learn To Code curriculum than by a course that requires editor/IDE setup.

This repository is aimed at programming courses in higher education (or late high school) that want to offer more depth, use the Swift Packager Manager for coding assignments, without being tied to Apple platforms. Such a course will have to teach some command line basics anyway, as that’s required to run the REPL and to create and run Swift packages.

For the instructions in the repository, no prior command line experience is required, as the instructions are written in such a way that the student can copy-and-paste the commands.

2 Likes

@jonas_vapor Are you still running CLion on Arch Linux? If so, would you be interested in maintaining the setup instructions for Arch and CLion?

Update: Thanks to @Ron_Olson, the repository now includes Fedora and CentOS/RHEL as supported platforms.

I’ve also updated the instructions for Visual Studio Code, so these platforms are now on par with Ubuntu. In fact, Fedora is even easier to use because it provides a native package!

I've also verified that the instructions for Ubuntu work for Pop!_OS as well, so that's one more distribution on the list!

In my experience, on Ubuntu 20.04, the following 3-step installation of Swift provides a better experience than the official instruction:

  1. Install homebrew
  2. Install swiftenv through homebrew
  3. Install Swift through swiftenv

I've only done this on Ubuntu 20.04, but I think it should work for all supported Unix-like platforms. Would it be beneficial if I add this as a general (alternative) instruction for all supported Unix-like platforms?

1 Like

I did consider swiftenv briefly, but ultimately, I decided against it because the commands aren’t that much simpler, I don’t want to require Linux user to install Homebrew, and I want to avoid additional dependencies.

For me, the added value in using swiftenv would be the ease of managing multiple versions, but that's not something I expect students in my target audience to do. They will just install whatever version their instructor, course, or textbook tells them to install, and then forget about it. By the time they have to upgrade to a newer version, they will have forgotten about swiftenv and probably just use whatever instructions they can find at that time.

I would also prefer not to include alternative instructions, as even the slightest bit of unclarity or confusion can trip up a new student :sweat_smile:

But the main issue here is of course the lack of native packages for Ubuntu. @Ron_Olson provides them for Fedora, and they work great, so I’m hoping we can get them on other distros as well. This should be our goal on all platforms.

1 Like

@svanimpe Your instructions to install sourcekit-lsp is not required. Official swift package already has the sourekit-lsp as part of the package.
swift-5.3-RELEASE-ubuntu18.04/usr/bin. You can use the same in your vscode.

@Santman The instructions are for installing the SourceKit-LSP extension for Visual Studio Code, not the actual language server (which is indeed already included).

PS: Any help in getting this repository to interested instructors/students by retweeting https://twitter.com/pwsacademy/status/1319326735415058434 is greatly appreciated as I lack the network to do so myself. Thanks :pray:

1 Like

Cool stuff. It's easy to get going on a Mac, but you can't expect all students to have Macs. My university often makes Linux VM images available that are already set up with the needed toolchain for a course, and one could use this resource if a course using Swift was to come.

Last I used Swift on Linux though it came with one massive issue. - Distribution. I couldn't link CoreFoundation statically and if I just accepted dynamic linking, well it needed to be in the same path I linked it against, so I needed to have an install script that placed it in the correct lib path. And I couldn't just say that it depended on swift-libs and tell people to apt install swift-libs or something. At least not back then but it is a while ago.

What a great resource!

Would you also be willing to collect Swift learning resources that aren't based on iOS?
(Sadly I don't know many of these...)

I have a lot of non-Mac-user friends that would like to try out programming, but I don't know of good tutorials that I can share with them.

Hi Xavier,

This repository is a spin-off of a larger project that’s been in development for almost four years now, and that I hope to share soon. Your non-Mac-user friends should be really happy with that!

1 Like