Skip to content

Preface ​

Programming with Swift: Fundamentals is our introductory programming course. It covers the fundamental building blocks of programming, such as variables, control flow, functions, data collections, and types.

In this course, you’ll learn the Swift programming language and build fun games, such as Tic-Tac-Toe, Blackjack, and Yahtzee.

Prerequisites ​

You don’t need any prior programming experience to start this course. However, we do assume some maturity and exposure to abstract concepts such as mathematics or grammar. A high school education should be sufficient.

Software requirements ​

Other than Swift itself, this course has no specific software requirements. You can use any of the major desktop operating systems to complete this course: macOS, Linux, and Windows. Getting Started will help you set up a development environment on your computer.

Objectives ​

The objectives for this course are as follows:

  • Syntax and grammar: Become fluent in writing code.
  • Best practices: Follow conventions and adopt a common code style.
  • Computational thinking: Solve problems by designing and implementing algorithms.
  • Collections: Store and process data using collections.
  • Types: Use custom types effectively and understand the differences between value types and reference types.
  • Documentation: Document your code and familiarize yourself with the Swift Standard Library documentation.
  • Process: Analyze a problem and design a solution before you write code.

Including evaluation, this course should take approximately 150 to 180 hours to complete.

Structure ​

This course has four parts. Other than the first, each part consists of chapters interspersed with exercises and ending with a programming challenge:

  • Part I introduces you to computing and guides you through the process of creating your first program.
  • Part II covers the basic building blocks of programs: expressions, statements, and functions. At the end of this part, you’ll build a game of Tic-Tac-Toe.
  • Part III explains how you can store and process collections of data. Your challenge for this part is to build a game of Blackjack.
  • Part IV takes your skills to a higher level by introducing custom types. You’ll then use these types to build a game of Yahtzee.

Each chapter, exercise, and challenge is part of a carefully designed learning path. It’s paramount that you read the chapters in order and that you complete every exercise and challenge before moving on.

Some of the exercises and challenges may seem difficult at first β€” this is intentional. Don’t give up and ask for help at the first sign of struggle. Instead, remove any distractions from your environment and focus on the problem at hand. Stick with it and take as much time as you need.

Challenging yourself with increasingly difficult problems is how you improve as a programmer. Don’t expect to learn how to program simply from reading instructions. Programming requires experience. The exercises and challenges in this course will give you that experience.

Resources ​

The solutions bundle contains solutions for all of the exercises and challenges in this course:

⬇️ Download the solutions bundle

If you find an issue with the text, instructions, or code, please report it on our issue tracker:

🐞 Report an issue
πŸ” Known issues

About Swift ​

Swift is a programming language developed by Apple. Swift’s unique blend of features makes it a solid choice for professional programmers as well as an excellent teaching language, which is why it was chosen for this course.

Swift is:

  • Safe: Swift has a strong focus on safety and avoids errors that are common in other languages. By learning Swift as your first language, you’ll develop good programming habits and write safe code.
  • Expressive: As a young and modern language, Swift builds on decades of experience and offers a powerful set of features. With Swift, you can get a lot done with very little code.
  • Fast: Swift succeeds in being both expressive and fast. This unique combination of expressive power and high performance means that you can use Swift to build nearly any application.
  • Elegant: Swift favors consistency and clarity over terseness. Compared to code written in other languages, Swift code is often easier to read and understand.
  • Approachable: Swift follows the principle of progressive disclosure. It hides advanced features from new learners and exposes them only when you’re ready to learn about them; this makes the language much easier to learn.

Swift is an open-source project, so anyone can contribute to it. As a result, Swift is rapidly growing from a language for Apple developers into a language that anyone can use.

Team ​

Steven Van Impe

Steven Van Impe


Tammy Coron

Tammy Coron