Hacking with Swift: Live!

A couple of weeks ago, I attended the first ever Hacking with Swift: Live! conference in Bath, England. Helpfully, Bath is less than an hour away from where I live so it seemed like a great opportunity to attend a conference while still getting to see my family. And it was fantastic!

If you’re not familiar with Hacking with Swift, it’s a website run by Paul Hudson. Paul is a one-man tutorial machine. I have no idea how he produces so much content. He’s written 15 books on Swift and Apple’s platforms, and his website contains a ton of free articles, tutorials, and videos all about Swift. His SwiftUI content has been really helpful, and again I don’t know how he created so much of it so soon after WWDC.

Hacking with Swift: Live was Paul’s first attempt at running this conference and I think it was a huge success. The venue was modern, clean, and bright, the wifi worked excellently, and the food was really good. There were around 200 attendees which felt like just the right number to me. The format of the event was a little different than other conferences I’ve attended before.

Day 1

Day 1 was quite standard conference fare, with 8 talks from some fantastic speakers: Cory Benfield (Apple), Kelly Hutchinson, Kilo Loco, Ellen Shapiro, Sally Shepard, Daniel Steinberg, John Sundell, and James Thomson. I particularly enjoyed:

  • Cory’s explanation of an easy place to get caught out in terms of performance with Swift’s copy-on-write behaviour.
  • Ellen’s talk about the Swift package manager, and using Swift scripts and tools to improve your development life.
  • Daniel’s talk, which cleverly walked through a SwiftUI example by calling out which Swift Evolution proposals were responsible for which pieces of syntax, and explained how they worked.
  • James’s history of easter eggs in Apple’s software.

But they were all great! The videos are all available on YouTube, and you can find links in this post on hackingwithswift.com.

Day 2

Day 2 was one big workshop. Paul literally wrote a book just for the conference, with 3 large example apps covering most of the big iOS 13 features. We then spent the day following along on our laptops as he led us through each tutorial. It was great to get a chunk of dedicated time working through a real example using the new features.

I particularly enjoyed the morning, which was all SwiftUI. I have to say I have been somewhat skeptical about SwiftUI up until this point (these kids and their new-fangled technologies, what’s wrong with the way we do it now? grumble mumble), but using it for a couple of hours… wow is it quick and convenient to build a UI and preview it.

The SwiftUI demo app we built

The other standout new pieces of API were diffable data sources (they clean up so much code!) and compositional collection view layouts.

A good cause

All of the proceeds from Hacking with Swift: Live went to charity. The conference supported Special Effect, a charity that “puts fun and inclusion back into the lives of people with physical disabilities by helping them to play video games”. It seemed like a great cause, and the conference was able to donate $30,000!

Summary

Paul ended the conference by talking about ‘the bigger picture’. How code brought us all together, but it’s not the most important thing in any of our lives, and how we should think about the difference we can all make in the wider world. He also said how proud he was to bring everybody together to his home town, and brought his family onstage to say they were his reason for doing everything he does. I may have cried a little 😅.

I really enjoyed the event and felt like it could’ve easily been a few days longer (although just two days was quite nice as it limited time away from home). I’m keen to go back next year if they hold it again!

Two Nifty Swift Loop Tricks

This week, I learnt two things about Swift that I’d never come across before. Both involve loops.

The first, via Erica Sadun: you can use case let in a for loop to conditionally bind optionals or cast items. Here’s the optional binding example from Erica’s post:

let items: [String?] = [nil, nil, "Hello", nil, "World"]
for case let item? in items {
    print(item)
}

Check out the full post, 3 simple for-in iteration tricks for some other neat tricks.

Secondly, from this post at KrakenDev: you can label loops in Swift! Here’s an example:

sectionLoop: for section in sections {
    rowLoop: for row in rows {
        if row.isMagical {
            break sectionLoop
        }
    }
}

Who knew?! There are a bunch more useful tips in the full post, Hipster Swift, including descriptions of what @noescape and @autoclosure actually do.