Swift Books

Learn Swift Programming with No-Charge Books

Swift is a powerful and intuitive general-purpose programming language for the OS X, iOS, watchOS, and Linux operating systems. It is 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 is 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.

We have published a series covering the best open source programming books for other popular languages. Read them here.

Swift Programming Language, The

The Swift Programming Language

By Apple Inc. (525 pages)

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

Swift Pocket Reference

Swift Pocket Reference

By Anthony Gray (186 pages)

This pocket reference sets out Swift’s modern language features, including type safety, generics, type inference, closures, tuples, automatic memory management, and support for Unicode.

Topics include:

  • Swift’s Run-Eval-Print-Loop (REPL) and interactive playgrounds
  • Supported data types, such as strings, arrays, and dictionaries
  • Variables and constants
  • Program flow: loops and conditional execution
  • Classes, structures, enumerations, functions, and protocols
  • Closures: similar to blocks in Objective-C and lambdas in C#
  • Optionals: values that can explicitly have no value
  • Operators, operator overloading, and custom operators
  • Access control: restricting access to types, methods, and properties
  • Built-in global functions and their parameter requirements

NOTE: This book is not released under an open source license.

Learn Swift

Learn Swift

By Aidan Finn (HTML)

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

NOTE: This book is not released under an open source license.

What's New in Swift 3

What’s New in Swift 3

By Paris Buttfield-Addison, Jon Manning, Tim Nugent (39 pages)

This book offers a concise tour of Swift 3 and its growing ecosystem. The book highlights the new features of Swift 3, and using it on non-Apple platforms.

This book helps the reader to:

  • Get a high-level view of Swift 3’s changes and new features, and learn how this version differs from Swift 2
  • Explore the Swift Evolution Process and the full list of accepted proposals—including those not yet implemented
  • Dive into Swift 3’s changes to the language’s syntax, standard library features, and other areas
  • Examine Swift 3’s use on the server, and use a simple program to learn about Swift’s use on Linux
  • Find further resources for learning about, working with, and converting projects to Swift 3

NOTE: This book is not released under an open source license.

Hacking with Swift

Hacking with Swift

By Paul Hudson (HTML)

Hacking 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 multipeer 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

NOTE: This book is not released under an open source license.

PROGRAMMING LANGUAGE PROFILES

Assembly, C, C++, C#, Clojure, CoffeeScript, ECMAScript, Go, Java, JavaScript, Perl, PHP, Python, R, Ruby, Scratch, Swift

Leave a Reply