Part I. Language

This part of the book teaches the Swift language, from the ground up. The description is rigorous and orderly. Here you’ll become sufficiently conversant with Swift to be comfortable with it, so that you can proceed to the practical business of actual programming.

  • Chapter 1 surveys the structure of a Swift program, both physically and conceptually. You’ll learn how Swift code files are organized, and you’ll be introduced to the most important underlying concepts of the object-oriented Swift language: variables and functions, scopes and namespaces, object types and their instances.

  • Chapter 2 explores Swift functions. We start with the basics of how functions are declared and called; then we discuss parameters — external parameter names, default parameters, and variadic parameters. Then we dive deep into the power of Swift functions, with an explanation of functions inside functions, functions as first-class values, anonymous functions, functions as closures, curried functions, and function references and selectors.

  • Chapter 3 starts with Swift variables — their scope and lifetime, and how they are declared and initialized, along with features such as computed variables and setter observers. Then some important built-in Swift types are introduced, including Booleans, numbers, strings, ranges, tuples, and Optionals.

  • Chapter 4 is all about Swift object types — classes, structs, and enums. It explains how these three object types work, and how you declare, instantiate, and use them. Then it proceeds to polymorphism and casting, protocols, generics, and extensions. The chapter concludes with a discussion of Swift’s umbrella types, such as Any and AnyObject, and collection types — Array, Dictionary, and Set (including option sets).

  • Chapter 5 is a miscellany. We start with Swift’s flow control structures for branching, looping, and jumping, including error handling. Then I describe Swift access control (privacy), introspection (reflection), and how to create your own operators. Next I talk about Swift memory management. The chapter ends with a survey of some recently added Swift language features: synthesized protocol implementations, key paths, dynamic members, property wrappers, custom string interpolation, reverse generics, function builders, and Result.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.13.255