7 Swift Coding Challenges to Practice Your Skills
When Apple announced Swift way back in 2014, people were rightfully skeptical. Nobody knew if it would catch on, and many questioned the need for yet another programming language to learn.
But then Swift went open source in 2015, and though it didn’t explode overnight, the language has steadily grown. There’s never been a better time to learn! We’ve covered online Swift tutorials as well as mobile Swift tutorials, but where do you go once you have the basics down?
Once you’re comfortable with the language, consider testing your skills with these Swift coding challenges. Not only are they fun and stimulating, but they’ll give you the confidence you need in your own abilities.
Codewars is the best place for practicing coding challenges of any kind, including Swift. The entire system is gamified, meaning you gain experience and level up with every successful challenge. It uses a similar ranking system as Go: you start at 8 Kyu and advance all the way to 1 Kyu.
Challenges (called “kata”) are categorized by their difficulty. Fortunately, there are thousands of challenges available, so even if you level up too quickly, you can always go back and work on the easier ones. Challenge types include algorithms, data types, string and number manipulation, control flow, puzzles, logic, and more.
What I love about Codewars is two-fold: first, finishing a kata lets you see the solutions submitted by other users, and second, users can create their own katas so the collection of challenges grows daily. It’s truly one of the best coding games for sharpening your skills .
The Swift coding challenges on CodinGame are more involved than the ones on Codewars, and that’s because CodinGame’s challenges are designed as games. For example, the “Power of Thor” challenge has you moving the position of Thor so that he can reach the Light of Power in as few steps as possible.
Challenges are categorized by difficulty, ranging from Easy to Medium to Hard to Very Hard. There are also community-made puzzles that you can try when you run out of the official ones. Beware that CodinGame’s challenges are pretty tough, but you’ll learn a lot in the struggle.
In addition to solo challenges, CodinGame also offers five-minute multiplayer coding battles (where you try to complete as many challenges as possible) and larger community-wide contests (which occur every month or two).
CodeChef offers challenges that are like coding homework problems. They’re divided into Beginner, Easy, Medium, Hard, and Challenge categories (plus an extra category called Peer for user-made challenges).
Hundreds of challenges are available, and they can get pretty hard. By comparison, most of the Beginner ones have 1,000+ successful submissions, the Medium ones average in the hundreds, but the Challenge ones rarely break 100 successful submissions. It’s good practice for newbies and veterans alike.
CodeChef also has contests. Not all of them offer prizes, but the official CodeChef contests can have prize pools up to $700.
DailyProgrammer is a Reddit community for programmers who want to test their mettle against with of the harder coding puzzles you’ll find on the web. It used to be a daily thing, but laetly it’s been more like every 2-3 days or so.
What’s nice is that challenges are marked as Easy, Intermediate, or Hard. The bad news is that even the Easy challenges, particularly the more recent ones, can be pretty tough for coding beginners. However, you can always dip into the archives and revisit old challenges if you like.
Project Euler is almost like a self-directed set of Swift coding challenges. The archives contain 600 total challenges (called “Problems”), but they don’t come with any answers or solutions or discussions. Usually it’s easy to know when you’ve solved the problem, but sometimes it isn’t — and that can be frustrating.
Also, Project Euler’s challenges are mainly mathematical and logical in nature. You can solve all of these without any programming necessary. However, as a way to exercise your brain, they’re fantastic. And since programming is all about solving real-world problems with code, this is essentially the same thing.
TopCoder‘s challenges are a bit different from the rest in this article, simply because they are multiplayer contests than solo puzzles. You have to register for them ahead of time, and then you have to complete them before time runs out.
The difference is that TopCoder’s challenges come with some hefty prize payouts. See in the screenshot above that, as of this writing, there are four in-progress challenges with thousands of dollars at stake. Not bad once you’ve honed your skills. It’s a good way to test your world-readiness as a Swift coder.
The only downside is that each challenge only supports a specific language or group of languages. While Swift coding challenges do exist, there may only be one every month or so.
Coderbyte may not be as exhaustive as some of the other challenge sites above, but it’s still an excellent way to practice Swift. The challenges (divided into Easy, Medium, and Hard) come with official and user-submitted step-by-step solutions, plus a discussion area for questions.
What’s unique about Coderbyte is its Algorithms section, where you can learn all kinds of algorithms: tree traversals, range overlaps, stock price maximization, array summations, sorting implementations, and more. Perfect for newbies.
Unfortunately, free users only get access to 10 challenges and solutions. A premium account costs $29/mo (or a much more reasonable $150/yr). Is it worth it? Well, use your 10 free challenges and see for yourself!
Some More Ways to Practice Swift
If Swift is your first programming language, bear in mind our tips for learning to program without the stress and our tips for mastering a new programming language . It can be tough at first, but stick with it!
Once you’re comfortable with Swift, you can move on with these iOS app project ideas and these general programming project ideas . Nothing instills programming confidence more than pursuing a real project and succeeding at it.
How are you liking Swift as a language? What’s your favorite way to learn and practice programming? Share with us down in the comments!