Transitioning to Swift

Book description

Developing apps for Apple’s broadening platform of devices is an exciting topic these days. Apple created the Swift programming language to build state-of-the-art apps using the latest Apple technologies.

In this 200-page book, author Scott Gardner articulates the similarities and differences between traditional Objective-C based programming and Swift, revealing what you need to know from syntax changes to emerging best practices and paradigm shifts, to write powerful, expressive, and flexible code in Swift.

Written at a brisk pace and in a methodical style, you'll learn how to apply your Objective-C skills to successfully transition to programming in Swift.

Table of contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Author
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Who This Book Is For
  11. Chapter 1: Getting Started
    1. Installing Xcode
    2. Creating a Playground
    3. Running a REPL
    4. Logging to the Console
    5. Adding Comments
    6. Using Dot Notation
    7. Summary
  12. Chapter 2: Declaring Variables and Constants
    1. Value Types and Reference Types
    2. Named Types and Compound Types
    3. Naming
    4. Mutability
    5. Declaring Type
    6. Defining Type
    7. Declaration Attributes
    8. @, *, and ;
    9. Declaring Values
    10. Writing Numeric Literals
    11. Access Control
    12. Protocol Adoption
    13. nil and Optionals
    14. Syntax Reference
    15. Summary
  13. Chapter 3: Working with Strings and Collections
    1. Working with Strings
    2. Creating Tuples and Collections
      1. Creating Tuples
      2. Creating Arrays
      3. Creating Dictionaries
    3. Mutability
    4. Multidimensional Tuples and Collections
    5. Working with Tuples and Collections
      1. Working with Tuples
      2. Working with Arrays
      3. Working with Dictionaries
    6. Syntax Reference
    7. Summary
  14. Chapter 4: Performing Operations
    1. Basic Operators
    2. Logical Operators
    3. Bitwise Operators
    4. Advanced Operators
    5. Operator Precedence and Associativity
    6. Summary
  15. Chapter 5: Controlling Program Flow
    1. Range Operators
    2. stride() Functions
    3. Control Transfer Statements
    4. Conditional Statements
    5. Iteration and Enumeration
    6. Labels
    7. Summary
  16. Chapter 6: Creating Functions
    1. Methods & Functions
    2. Currying
    3. Overloading
    4. Custom Operators
    5. Blocks and Closure Expressions
    6. Declaration and Type Attributes
    7. Summary
  17. Chapter 7: Constructing Classes, Structures, and Enumerations
    1. Naming Conventions
    2. Classes and Structures
      1. Classes
      2. Structures
    3. Enumerations
    4. Initialization
      1. Class Initialization
      2. Structure Initialization
      3. Enumeration Initilialization
      4. Failable Initializers
    5. Properties
    6. Enumeration Associated Values
    7. Subscripts
    8. Methods
    9. Declaration and Type Attributes
    10. Class Deinitialization
    11. Avoiding Strong Reference Cycles
    12. Singletons
    13. Selection Guidelines
    14. Summary
  18. Chapter 8: Defining and Adopting Protocols
    1. Use Cases
    2. Naming
    3. Defining
    4. Adopting
    5. Type Checking and Casting
    6. Summary
  19. Chapter 9: Subclassing and Extending
    1. Subclassing
      1. Initializer Inheritance
      2. Overriding
      3. Deinitializer Inheritance
    2. Extending
      1. Protocol Adoption Via An Extension
    3. Summary
  20. Chapter 10: Controlling Access
    1. Access Control Compared
    2. Assigning Access Levels
    3. Summary
  21. Chapter 11: Generic Programming
    1. Specific versus Generic
    2. Syntax
      1. Functions and Types
      2. Where Clauses and Protocol Associated Types
    3. Usage Examples
    4. Summary
  22. Index

Product information

  • Title: Transitioning to Swift
  • Author(s): Scott Gardner
  • Release date: December 2014
  • Publisher(s): Apress
  • ISBN: 9781484204061