Skip to main content

Install Swift

To use Alchemy, you’ll first need to make sure Swift is installed.
  • macOS
  • Linux
Install and open the latest Xcode.

Create a Project

Once that’s finished, create a new project using the create Alchemy app script.
bash <(curl -s https://raw.githubusercontent.com/alchemy-swift/examples/main/create-alchemy-app.sh)

Run the App

Finally, run your app and visit localhost:3000 in the browser.
cd {project-name}
swift run app # hang tight, the first build takes a moment

Setup your Editor

There are two main editor options for writing Swift - Xcode and Visual Studio Code. Here are some helpful tips for you to get set up with either.
Set a custom working directoryBy default, Xcode builds and runs all projects in a separate directory; ~/Library/Developer/Xcode/DerivedData/. This isn’t an issue for iOS apps, but it means that your Alchemy app won’t be able to access important assets in your project such as an .env file or a Public/ directory.Fortunately this is simple to fix. You just need to tell Xcode to build and run your app in the root directory of your project: Command + Shift + < -> Run -> Options -> select 'Use custom working directory:' -> enter the root directory of your project.Accessing hidden filesYou’ll likely be configuring your Alchemy app with a .env file. Xcode is unable to edit or view hidden files (files prefaced with a .). When it comes time to work with these files, you’ll need to use a text editor that can access them such as Visual Studio Code.

Next Steps

Congrats! You’re up and running with Alcehmy. Keep following the guides to see what you can build. If you get stuck at any point, drop in and ask questions in the official Discord.
I