Swift Algorithm Club: August 2017 Digest

Check out the latest news from the Swift Algorithm Club, including an update on the Swift 4 migration, and a new data structure added to the repo! By Kelvin Lau.

Save for later


Hide contents

Swift Algorithm Club: August 2017 Digest

3 mins

The Swift Algorithm Club is a popular open source project to implement popular algorithms and data structures in Swift, with over 13,000 stars on GitHub.

We periodically give status updates with how things are going with the project. This month, we report on our progress with the Swift 4 update.

Swift 4 Migration

Swift 4 is bundled with Xcode 9, and it’s coming next month. That means all of our topics need to be migrated over from Swift 3 to Swift 4. Most of the changes are relatively minor, but each topic did need to be checked over.

I’d like to specially thank remlostime who spent significant time updating the topics several dozens of topics to Swift 4.

So far, 71 of the 88 topics have been successfully migrated to Swift 4:

All done in 1 day, by 1 person!

There’s a couple of topics left, so if you’re interested in contributing to open source, this is a great opportunity to get started. Migration has generally been straightforward – it’s just the process of:

  • Making sure the playground compiles correctly
  • Making sure README.md file reflects the updated playground
  • Adding a small code check to mark that the code has been updated to Swift 4
    // last checked with Xcode 9.0b4
    #if swift(>=4.0)
       print("Hello, Swift 4!")

The migration from Swift 3 to Swift 4 has been really smooth. For many topics, no changes were necessary. I’ve seen more swapAt(:) changes more than anything else; Due to the recent changes with memory ownership for Swift 4, swapAt(:) now sits as a member of the MutableCollection protocol.

If you’ve ever wanted to contribute to the Swift Algorithm Club, now’s a great time! It’s a great way to learn about algorithms and Swift 4 at the same time.

If you’d like to contribute, check out the Swift 4 migration issue for more information on how to sign up.

Note: The most straightforward way of compiling in Swift 4 is to use Xcode 9 beta, which you may download from Apple here.

Other News

In addition to the usual minor updates and fixes to the repo, we’ve got a new topic on the Hashed Heap data structure.

This is a variant of the Heap data structure; The Hashed Heap offers a better time complexity by using a dictionary to speed up lookup of elements. Thanks Alejandro Isaza!

Where To Go From Here?

The Swift Algorithm Club is always looking for new members. Whether you’re here to learn or here to contribute, we’re happy to have you around.

To learn more about the SAC, check out our introductory article. We hope to see you at the club! :]