0%

Head First Swift

Swift is a programming language you can rely on. A language you can present to the family. Safe, reliable, speedy, friendly, easy to talk to, it’s the language of choice for Apple’s platforms—iOS, macOS, watchOS, and tvOS. But open source Swift also runs on Linux as well as the server, and it's gaining ground in scientific computing and web apps. Swift for Windows is even in the works. You can build everything from mobile apps to games, web apps, frameworks, and beyond. So jump in and get started!

What's so special about this book?

If you've read a Head First book, you know what to expect—a visually rich format designed for the way your brain works. If you haven't, you're in for a treat. With this book, you'll learn Swift through a multisensory experience that engages your mind rather than a text-heavy approach that puts you to sleep.

Table of Contents

  1. 1. Introducing Swift: Apps, web, AI, and beyond!
    1. Swift is a language for everything
    2. Swift has evolved fast.
    3. The swift evolution of Swift
    4. How you’re going to write Swift
    5. The path you’ll be taking
    6. Getting Playgrounds
    7. Downloading and installing Playgrounds on macOS
    8. Creating a Playground
    9. Using a Playground to code Swift
    10. Basic building blocks
    11. A Swift Example
    12. Here’s what you need to build
    13. The print function
    14. Building a list of ingredients
    15. Picking four random ingredients
    16. Displaying our random pizza
    17. Congrats on your first Swift steps
    18. There are no Dumb Questions
    19. Swiftcross
    20. Swiftcross
  2. 2. Swift by name: Swift by Nature
    1. Building from the blocks
    2. Basic Operators
    3. Operating swiftly with mathematics
    4. Expressing yourself
    5. Names and types. Peas in a pod.
    6. Not all data are numbers
    7. These are all types
    8. Stringing things along with Types
    9. String interpolation
    10. There are no dumb Questions
    11. Swiftcross
  3. 3. Collecting and Controling: Going Loopy for Data
    1. Sorting pizzas
    2. Swift Collection Types
    3. Collecting values in an array
    4. How big is that array, exactly? Is it empty?
    5. Collecting values in a set
    6. Collecting values in a dictionary
    7. Tuples
    8. Everyone needs a good alias
    9. Control flow statements
    10. If statements
    11. Switch statements
    12. Building a Switch statement
    13. Range operators
    14. More complex switch statements
    15. Getting repeatative with loops
    16. Building a For Loop
    17. Building a while loop
    18. Building a repeat-while loop
    19. Solving the pizza sorting problem
    20. There are no Dumb Questions
    21. Phew, that’s a lot of Swift!
    22. Swift Code Magnets
    23. Pool Puzzle
    24. BE the Swift compiler
    25. Swiftcross
    26. Code Magnets
    27. Pool Puzzle
    28. BE the Swift compiler
    29. Swiftcross
  4. 4. Functions: Re-using code on Demand
    1. Functions in Swift let you reuse code.
    2. What can functions do?
    3. Built-in functions
    4. BE the Swift compiler
    5. What can we learn from built-in functions?
    6. What’s the problem here?
    7. Improving the situation with a function
    8. Writing the body of the function
    9. Using functions
    10. Functions deal in values
    11. Many happy returns (from your functions)
    12. But Swift is meant to make things simple...
    13. A variable number of parameters
    14. What can you pass to a function?
    15. Every function has a type
    16. Behind the Scenes
    17. Function types as parameter types
    18. Multiple return types
    19. Functions don’t have to stand alone
    20. Nested functions
    21. Functioncross
    22. Functioncross Solution
  5. 5. Closures: Functions are Flexible
    1. Meet the humble closure
    2. Closures are better with parameters
    3. Boiling it all down to something useful
    4. The Problem
    5. The Solution
    6. Reducing with closures
    7. Behind the Scenes
    8. Capturing values from the enclosing scope
    9. What came first, the function or the closure?
    10. Escaping closures the contrived example
    11. Behind the Scenes
    12. Autoclosures provide flexibility
    13. The Situation
    14. The Problem
    15. The Solution
    16. Shorthand argument names
    17. Closurecross
    18. BE the Swift compiler
    19. Closurecross
3.238.12.0