This developer rebuilt his entire website using Swift

While most sites are with HTML, CSS, and JavaScript, and generated with a CMS like WordPress or EmDash, Sindre Sorhus decided to .

Swift is a strange choice because it’s , like iOS, macOS, watchOS, and tvOS. But Swift can do a lot, including with web frameworks like Vapor and Hummingbird.

Sorhus figured it out by using the to generate the HTML and routes using a small framework he built on top of it. And if you’re unfamiliar, Elementary is an for Swift that’s inspired by SwiftUI.

His main reason for using Swift was the compiler. He found that it could catch issues like broken links, and it wouldn’t compile. Thus, keeping him from pushing broken changes to his site.

Sorhus made it so the site is statically generated and the content is stored as Markdown files. When he makes updates, it deploys to GitHub Pages with a single GitHub Actions workflow.

The best part is that Sorhus , so anyone can see how he did it. Using Swift for a website is unusual, but he’s shown that it can be done, and if you want to try it yourself, you now have a working example to follow at .

Leave a Comment