UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Test your Swift

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 click Start for your chosen test. Your score is 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 5.4 or later.

Warning: these tests place a cookie in your browser. This allows us to track the answers you submit to each question so we can show you your results. This cookie is deleted when you close your browser.

All set? Let's do this…

What are the difficulty settings?

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 macOS 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.

What is the question format?

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.

Are there any rules to follow?

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.

What kind of Swift is used?

You should assume that all code shown to you is being run in a playground using Swift 5.4 or later, and you should assume that Foundation is available. 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.

I found a mistake – what do I do?

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!

How can I contact you?

You can follow me on Twitter if you like – I tweet regularly about interesting iOS development topics.

Alternatively, you can email me at paul@hackingwithswift.com, but please be as specific as you can – screenshots if possible.

Can I get a certificate?

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.

Have fun!

BUY OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.