If you're looking to find a way to see just how much Swift you know, you've come to the right place: I've put together three Swift tests suitable for a range of experience levels, each of which will help you identify how much you know, and perhaps how much you still have to learn.
The test begins when you enter your name below and click Start for your chosen test. Your name and score are not stored. When you finish the test you'll be given a unique URL that verifies your score was achieved by you at a specific time.
Before you start, you might find it useful to read the frequently asked questions below. Short version: assume all code shown to you is being run in a playground using Swift 4.0 or later.
All set? Let's do this…
There are three test difficulties: Novice, Intermediate, and Expert. I suggest you start with Novice and work your way forward, rather than dive in and struggle.
"Novice" is not the same as "Beginner" – you are expected to have some familiarity with Swift. If you have read the introduction to Hacking with Swift you should probably be fine. Think of Novice as "I have six months' of Swift experience", Intermediate as "I've been using Swift over a year", and Expert as "I dream in closures, I regularly use Swift betas, I'm Chris Lattner, or all three."
There is a range of difficulty within each test, meaning that some questions are easier than others. Please read each of them carefully. "Expert" level throws some deliberately obtuse questions at you, so brace yourself!
All questions test only your knowledge of Swift syntax, the Swift standard library and Foundation; you need to know nothing about iOS or OS X programming.
WARNING: Some questions are deliberately sneaky, even at Novice level. You really do need to read the code fully, then examine each answer option, before continuing. Once you answer each question you cannot return to it, so take your time.
Each test is composed of 20 questions, taken from a pool of 30 questions at each difficulty level. This means the selection of questions you receive each time will be slightly different.
Questions are served in a random order. Each question has one answer, which you must select from the list of available options.
You can only move forward in a test; once you have answered a question, you will not be able to return to it.
There is no time limit, or indeed any attempt to stop you cheating. If you cheat, you're just cheating yourself.
You should assume that all code shown to you is being run in a playground using Swift 4.0 or later. Beyond that, it's all up in the air.
You can expect to see good code, bad code, code that won't even compile, code that works but could have been written better, and more. If you find some code that's hard to read or looks broken, trust me: that's intentional. If it looks broken, it probably is broken, so just answer that it won't compile.
Please don't complain to me about the questions. They are designed to test your knowledge and are just for fun, not to serve as recommendations for how to write beautiful Swift code.
When you finish the test, a unique URL is generated that encrypts your name and your test score. This means your name or test result are never stored by me – it's all in that magic URL.
Because this URL will work forever, you can share it with others to prove your score at a certain test difficulty level.
You're welcome to use a fake name, but be warned: this is the same name that will be shown on your confirmation URL.
Congratulations! Just click on the link on the results page to claim your discount. If you lost the URL, I'm afraid you'll need to complete the test again.
OK, take a deep breath and listen carefully: you probably didn't find a mistake. If you answered a question and got it wrong, please read the explanation I give in the test results screen.
If you've read that and disagree with what I've written, just try pasting the code into an Xcode playground and seeing for yourself.
Once you've pasted the code into Xcode, there are two possible outcomes: either you learn that my answer was correct (you learned something new today – internet high five!) or you confirmed that my answer was definitely wrong. IF AND ONLY IF you have run the code through Xcode and spotted a genuine mistake, please tell me about it.
PLEASE NOTE: If you have not pasted the code into Xcode to see the result for yourself, please don't complain that my answer is not correct. Take a moment to try it for yourself!
You can follow me on Twitter if you like – I tweet regularly about interesting iOS development topics.
Alternatively, you can email me at firstname.lastname@example.org, but please be as specific as you can – screenshots if possible.
I'm afraid not. These tests are not sponsored or approved by either Apple or the Swift development team; they are unofficial, and designed only to help you gauge your level.
Test your Swift today
Think you know Swift? My book Swift Coding Challenges will put your Swift skills to the test – it's perfect for job interviews and more!