Smarter! Faster! Darker!
Two months ago Hacking with Swift passed 25 million page views, which is a huge accomplishment that I’m really proud of. I wanted to celebrate with something special, so I decided it was time to implement our #1 most requested feature: site search.
Site search was something I listed in my plans for 2019 nine months ago, and it’s been something folks have been requesting as long as I can remember. Of course, when I sat down to actually make site search happen I ended up changing practically everything else at the same time, and the result was the third major site update for Hacking with Swift.
Let me talk you through what’s changed…
Yes, I set out to make site search work, and obviously it would suck if that got missed out during the big refresh!
So, now you’ll see a permanent search box in the top-right corner of every page (or hidden behind the burger menu if you’re on mobile), along with a large search box on every page. This uses a full-text search of all articles, example code, tutorials, guide, and more, so you can be sure you’re seeing across the whole site.
But I wanted to take search one step further: you can now go straight to hackingwithswift.com/your-search-term to search across the site immediately. Here are some examples to get you started:
And yes, you can include spaces if you want – just enter “hackingwithswift.com/“ followed by anything you want to search for.
Site search was always the most-requested feature, but not far after was support for a dark theme. Well, it’s now active, and it’s automatic depending on the setting of your device – if you use dark mode on macOS or iOS, you’ll get dark mode here.
To help ensure readability I’ve bumped up the weights of almost all the fonts, and – ahem – borrowed the dark mode UI colors from iOS 13 and Xcode 11, so hopefully things should look familiar.
Having solved the first two most common feature requests, I went on to the third: making it easier to find content in the site.
This has long been a problem for me, because – bluntly – I much prefer writing about Swift than futzing with websites. This often meant I didn’t think about navigation around the site, didn’t consider discoverability, and certainly didn’t make it easy to find what was new for regular visitors.
One of the effects of this was that it was hard for newcomers to figure out where to start amongst all my tutorials, which is never a pleasant place to be. Worse, in 2019 I launched the 100 Days of Swift and SwiftUI By Example – two major projects that were impossible to find on the site, so you literally had to know the exact URL or rely on Google.
So, in this refresh I picked all that lovely low-hanging fruit and more:
Yes, I know: actually linking to my own pages sounds like an obvious thing to do, but like I said it’s much more fun to be writing about Swift than modifying my site.
Hacking with Swift now serves about 1.5 million page views every month, and of course that’s a great thing. However, it forced me to re-evaluate the way I serve up pages so that I can make sure everyone gets a great quality of service.
Just before WWDC I massively upgraded the server that hosts the site, going from a single-core 1GB RAM setup to a quad-core 8GB RAM setup. That in itself was never going to do that much for performance, but it also allowed me to upgrade the software that runs the site, and deploy a huge range of optimizations to make sure pages are served faster than ever.
The result is that every page is now delivered 8 to 10 times faster than before – it is screamingly fast now, even when serving thousands of users every hour.
I fixed and added so many little things that it’s hard to keep track of them all, but here are a few:
Site search, dark mode, better navigation, and more speed are all nice to have individually, but combined I think will do a lot to take Hacking with Swift forwards for a good few years to come.
For now, though, it’s back to writing for me. Hopefully I won’t need to wait quite so many years to do another site update, but with so many exciting new things in iOS 13 it will be a while before I written everything I want to see.
If you spot any problems with the site, tweet me @twostraws and I’ll get it resolved as fast as I can.
LEARN SWIFTUI FOR FREE I have a massive, free SwiftUI video collection on YouTube teaching you how to build complete apps with SwiftUI – check it out!
Paul Hudson is the creator of Hacking with Swift, the most comprehensive series of Swift books in the world. He's also the editor of Swift Developer News, the maintainer of the Swift Knowledge Base, and a speaker at Swift events around the world. If you're curious you can learn more here.