Free Programming Books

3 Excellent Free Books to Learn Swift

Swift is a powerful and intuitive general-purpose programming language for the OS X, iOS, watchOS, and Linux operating systems. It’s developed by Apple Inc. Swift is intended to be more resilient to erroneous code (“safer”) than Objective-C, and more concise.

Swift is a new language, first appearing in 2014. It’s friendly to new programmers, feels familiar to Objective-C developers, and the language is optimized for development. It was launched under a proprietary license, but Apple made the language open source in December 2015 by releasing Swift 2.2 and later under the Apache License 2.0. By open-sourcing Swift, developers are able to use the language for their own purposes and go beyond OS X, iOS and watchOS apps.

Besides the official Swift Programming Language book (featured below), there are no other good quality open source Swift books. Given the short passage of time since Apple open sourced the language, this isn’t that surprising. There was an interesting ‘The Swift Book’, which is available under the MIT license, but it is mostly incomplete and updates have stalled. Fortunately, there are some excellent Swift books which can be read without charge which fill the void.

As at August 2019, Swift ranks 18th on the TIOBE Programming Community index, an indicator of the popularity of programming languages.

The focus of this article is to select the finest free Swift books which help programmers master this language, and develop an in-depth understanding of the benefits that this programming language offers. Each book is available to download without payment. Some of the books are available to purchase too.


1. The Swift Programming Language by Apple Inc.

Swift Programming LanguageThe Swift Programming Language is the authoritative reference for Swift, offering a guided tour, a comprehensive guide, and a formal reference of the language.

The book is available as a ePub, but there are PDF versions available to download.

This book is made available under the Creative Commons Attribution 4.0 International (CC BY 4.0) License. Unfortunately, the rest of the books featured in this article are not released under an open source license.

Read the book


2. Hacking with Swift by Paul Hudson

Hacking With SwiftHacking with Swift is designed for beginners to intermediate programmers wishing to learn Swift 3 and iOS development with real-world, practical projects. The e-book contains the following projects.

  1. Storm Viewer: Get started coding in Swift by making an image viewer app and learning key concepts.
  2. Guess the Flag: Make a game using UIKit, and learn about integers, buttons, colors and actions.
  3. Social Media: Let users share to Facebook and Twitter by modifying project 1.
  4. Easy Browser: Embed Web Kit and learn about delegation, KVO, classes and UIToolbar.
  5. Word Scramble: Create an anagram game while learning about closures and booleans.
  6. Auto Layout: Get to grips with Auto Layout using practical examples and code.
  7. Whitehouse Petitions: Make an app to parse Whitehouse petitions using JSON and a tab bar.
  8. 7 Swifty Words: Build a word-guessing game and master strings once and for all.
  9. Grand Central Dispatch: Learn how to run complex tasks in the background with GCD.
  10. Names to Faces: Get started with UICollectionView and the photo library.
  11. Pachinko: Dive into SpriteKit to try your hand at fast 2D games.
  12. UserDefaults: Learn how to save user settings and data for later use.
  13. Instafilter: Make a photo manipulation program using Core Image filters and a UISlider.
  14. Whack-a-Penguin: Build a game using SKCropNode and a sprinkling of Grand Central Dispatch.
  15. Animation: Bring your interfaces to life with animation, and meet switch/case at the same time.
  16. JavaScript Injection: Extend Safari with a cool feature for JavaScript developers.
  17. Swifty Ninja: Learn to draw shapes in SpriteKit while making a fun and tense slicing game.
  18. Debugging: Everyone hits problems sooner or later, so learning to find and fix them is an important skill.
  19. Capital Cities: Teach users about geography while you learn about MKMapView and annotations.
  20. Fireworks Night: Learn about timers and color blends while making things go bang!
  21. Local Notifications: Send reminders, prompts and alerts even when your app isn’t running.
  22. Detect-a-Beacon: Learn to find and range iBeacons using our first project for a physical device.
  23. Space Race: Dodge space debris while you learn about per-pixel collision detection.
  24. Swift Extensions: Try your hand at improving the built-in data types of Swift.
  25. Selfie Share: Make a multi-peer photo sharing app in just 150 lines of code.
  26. Marble Maze: Respond to device tilting by steering a ball around a vortex maze.
  27. Core Graphics: Draw 2D shapes using Apple’s high-speed drawing framework.
  28. Secret Swift: Save user data securely using the device keychain and Touch ID.
  29. Exploding Monkeys: Remake a classic DOS game and learn about destructible terrain and scene transitions.
  30. Instruments: Become a bug detective and track down lost memory, slow drawing and more.
  31. Multibrowser: Get started with UIStackView and see just how easy iPad multitasking is.
  32. SwiftSearcher: Add your app’s content to Spotlight search and take advantage of the new Safari integration.
  33. What’s that Whistle?: Build a crowd-sourced song recognition app using Apple’s free platform as a service. CloudKit.
  34. Four in a Row: Let iOS take over the AI in your games using GameplayKit.
  35. Generating random numbers: GameplayKit can help you generate random numbers in ways you soon won’t be able to live without.
  36. Crashy Plane: Ever wanted to make a Flappy Bird clone? Now you can do it in under an hour thanks to SpriteKit.
  37. Psychic Tester: Are you psychic? Of course not. But what if we could use our coding skills to make a game to fool your friends into thinking otherwise?
  38. GitHub Commits: Get on board with Core Data and learn to read, write and query objects using Apple’s object graph and persistence framework.
  39. Unit testing with XCTest: Learn how to write unit tests and user interface tests using Xcode’s built-in testing framework.

This book is not released under an open source license.

Read the book


3. Learn Swift by Aidan Finn

Learn SwiftSwift is a wonderful language that gives you an easy entry-point into the Apple developer ecosystem. If you’ve been put off developing for OS X and iOS because of the need to learn Objective-C, now is the time to start.

Swift offers a relatively smooth transition from languages like Ruby and Python. This short book offers you a whirlwind tour of Swift. The aim of this book is to quickly and succinctly introduce and demonstrate all the major features of the Swift programming language.

Chapters cover:

  • Running Code – create a simple hello world program and run it in Swift.
  • Basics – sets out some of the basics of Swift.
  • Constants and Variables.
  • Static Typing and Type Inference – with reference to the benefits of static typing.
  • Arrays.
  • Dictionaries – learn how to perform some common operations on dictionaries.
  • Tuples – a brief look at this ordered list of elements.
  • Control Flow – if, loops, switch, altering control.
  • Optionals – declaring, forced unwrapping, conditional unwrapping, using optionals, and dictionaries.
  • Functions and Closures – defining and more.
  • Classes – introduces classes, showing you how to define a class, methods, properties: stored and computed, lazy stored properties, property callbacks, subscripts, object initialization, deinitialization, inheritance, and more.
  • Structures – highlights the differences between structures and classes.
  • Enumerations – defining and using, raw values, associated values, associates values versus raw values, pattern matching with switch.
  • Protocols – defining and conforming to a protocol.
  • Extensions – defining extensions.
  • Memory Management – highlights where you may need to get involved in the memory management of objects manually.
  • Error handling – try, catch and throws, assertions, enums.
  • Generics – a way of defining functions or types that can work with multiple different data types.
  • What next? – some resources for building iOS or OS X apps in Swift.

Read the book


All books in this series:

Free Programming Books
JavaGeneral-purpose, concurrent, class-based, object-oriented, high-level language
CGeneral-purpose, procedural, portable, high-level language
PythonGeneral-purpose, structured, powerful language
C++General-purpose, portable, free-form, multi-paradigm language
C#Combines the power and flexibility of C++ with the simplicity of Visual Basic
JavaScriptInterpreted, prototype-based, scripting language
PHPPHP has been at the helm of the web for many years
HTMLHyperText Markup Language
SQLAccess and manipulate data held in a relational database management system
RubyGeneral purpose, scripting, structured, flexible, fully object-oriented language
AssemblyAs close to writing machine code without writing in pure hexadecimal
SwiftPowerful and intuitive general-purpose programming language
GroovyPowerful, optionally typed and dynamic language
GoCompiled, statically typed programming language
PascalImperative and procedural language designed in the late 1960s
PerlHigh-level, general-purpose, interpreted, scripting, dynamic language
RDe facto standard among statisticians and data analysts
COBOLCommon Business-Oriented Language
ScalaModern, object-functional, multi-paradigm, Java-based language
FortranThe first high-level language, using the first compiler
ScratchVisual programming language designed for 8-16 year-old children
LuaDesigned as an embeddable scripting language
LogoDialect of Lisp that features interactivity, modularity, extensibility
RustIdeal for systems, embedded, and other performance critical code
LispUnique features - excellent to study programming constructs
AdaALGOL-like programming language, extended from Pascal and other languages
HaskellStandardized, general-purpose, polymorphically, statically typed language
SchemeA general-purpose, functional language descended from Lisp and Algol
PrologA general purpose, declarative, logic programming language
ForthImperative stack-based programming language
ClojureDialect of the Lisp programming language
JuliaHigh-level, high-performance language for technical computing
AwkVersatile language designed for pattern scanning and processing language
CoffeeScriptTranscompiles into JavaScript inspired by Ruby, Python and Haskell
BASICBeginner’s All-purpose Symbolic Instruction Code
ErlangGeneral-purpose, concurrent, declarative, functional language
VimLPowerful scripting language of the Vim editor
OCamlThe main implementation of the Caml language
ECMAScriptBest known as the language embedded in web browsers
BashShell and command language; popular both as a shell and a scripting language
LaTeXProfessional document preparation system and document markup language
TeXMarkup and programming language - create professional quality typeset text
ArduinoInexpensive, flexible, open source microcontroller platform
TypeScriptStrict syntactical superset of JavaScript adding optional static typing
ElixirRelatively new functional language running on the Erlang virtual machine
F#Uses functional, imperative, and object-oriented programming methods
TclDynamic language based on concepts of Lisp, C, and Unix shells
FactorDynamic stack-based programming language
EiffelObject-oriented language designed by Bertrand Meyer
AgdaDependently typed functional language based on intuitionistic Type Theory
IconWide variety of features for processing and presenting symbolic data
XMLRules for defining semantic tags describing structure ad meaning
ValaObject-oriented language, syntactically similar to C#
Standard MLGeneral-purpose functional language characterized as "Lisp with types"
DGeneral-purpose systems programming language with a C-like syntax
DartClient-optimized language for fast apps on multiple platforms
MarkdownPlain text formatting syntax designed to be easy-to-read and easy-to-write
KotlinMore modern version of Java
Objective-CObject-oriented language that adds Smalltalk-style messaging to C
PureScriptSmall strongly, statically typed language compiling to JavaScript
ClojureScriptCompiler for Clojure that targets JavaScript
VHDLHardware description language used in electronic design automation
Share this article

Share your Thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.