Sets up a nice little environment for Swift scripting in VSCode.
Because sometimes you're not about setting up an entire XCode project to write some Swift.
But isn't that what executable Swift packages are for?
I mean, yeah, but it's a conceptual difference. When you just want to script a bit of logic in Swift, you're not trying to write a whole package. It's like jotting down notes from a meeting, but making sure you bind the signatures in your hard-bound notebook first.
Why not just open a Swift playground?
... Again, it's the concept. And you can't debug and compile a .playground
file.
It sets you up a simple, debuggable, buildable environment to write your Swift in VSCode.
Doesn't the Swift extension for VSCode already do that?
As it turns out, no. As of time of writing, the Swift extension provides Swift language support and an automated pipeline for setting up LLDB to debug Swift packages. The CodeLLDB extension is what does the heavy lifting, and the Swift extension is only set up to let it work on packages. If you're looking to debug Swift in any other context--building an app, writing a command line utility, etc.--the Swift extension won't help you.
Look--that's on the list. For now this is for VSCode.
Clone the repo and add it to your path.
If you forget anything, just run swiftpaper
in the command line. For example:
swiftpaper
It'll walk you through everything.
Create a new directory, navigate into it, and run swiftpaper init
. Like this:
cd
mkdir newProject
cd newProject
swiftpaper init
If you want to tweak the setup, you have three options:
- Fork the repo
- Create a
~/.swiftpaper_before
file - Create a
~/.swiftpaper_after
file
~/.swiftpaper_before
and ~/.swiftpaper_after
get sourced before and after swiftpaper
sets up the environment, so they're good places for anything you want to happen apart from what's in the box.
For example, say you want to symlink a stock .swift-format
and .swiftlint.yml
, add both to .gitignore
, and open a git repo. ~/.swiftpaper_after
can handle all of that:
ln -s $HOME/Repos/shDotFiles/.swift-format
ln -s $HOME/Repos/shDotFiles/.swiftlint.yml
echo .swift-format >> .gitignore
echo .swiftlint.yml >> .gitignore
git init &> /dev/null
There's not much else. Happy Swifting!