You are previewing iOS Programming: The Big Nerd Ranch Guide.
O'Reilly logo
iOS Programming: The Big Nerd Ranch Guide

Book Description

iOS Programming: The Big Nerd Ranch Guide leads you through the essential concepts, tools, and techniques for developing iOS applications. After completing this book, you will have the know-how and the confidence you need to tackle iOS projects of your own. Based on Big Nerd Ranch's popular iOS Bootcamp course and its well-tested materials and methodology, this bestselling guide teaches iOS concepts and coding in tandem. The result is instruction that is relevant and useful.

Throughout the book, the authors explain what's important and share their insights into the larger context of the iOS platform. You get a real understanding of how iOS development works, the many features that are available, and when and where to apply what you've learned.

Table of Contents

  1. Title Page
  2. Acknowledgments
  3. Table of Contents
  4. Introduction
    1. Prerequisites
    2. What Has Changed in the Fifth Edition?
    3. Our Teaching Philosophy
    4. How to Use This Book
    5. Using an eBook
    6. How This Book Is Organized
    7. Style Choices
    8. Typographical Conventions
    9. Necessary Hardware and Software
  5. 1. A Simple iOS Application
    1. Creating an Xcode Project
    2. Model-View-Controller
    3. Designing Quiz
    4. Interface Builder
    5. Building the Interface
      1. Creating view objects
      2. Configuring view objects
      3. Running on the simulator
      4. A brief introduction to Auto Layout
      5. Making connections
        1. Declaring outlets
        2. Setting outlets
        3. Defining action methods
        4. Setting targets and actions
        5. Summary of connections
    6. Creating the Model Layer
      1. Implementing action methods
      2. Loading the first question
    7. Building the Finished Application
    8. Application Icons
    9. Launch Screen
  6. 2. The Swift Language
    1. Types in Swift
    2. Using Standard Types
      1. Inferring types
      2. Specifying types
        1. Number and Boolean types
        2. Collection types
      3. Literals and subscripting
      4. Initializers
      5. Properties
      6. Instance methods
    3. Optionals
      1. Subscripting dictionaries
    4. Loops and String Interpolation
    5. Enumerations and the Switch Statement
      1. Enumerations and raw values
    6. Exploring Apple’s Swift Documentation
  7. 3. Views and the View Hierarchy
    1. View Basics
    2. The View Hierarchy
    3. Creating a New Project
    4. Views and Frames
      1. Customizing the labels
    5. The Auto Layout System
      1. Alignment rectangle and layout attributes
      2. Constraints
      3. Adding constraints in Interface Builder
      4. Intrinsic content size
      5. Misplaced views
      6. Adding more constraints
    6. Bronze Challenge: More Auto Layout Practice
  8. 4. Text Input and Delegation
    1. Text Editing
      1. Keyboard attributes
      2. Responding to text field changes
      3. Dismissing the keyboard
    2. Implementing the Temperature Conversion
      1. Number formatters
    3. Delegation
      1. Conforming to a protocol
      2. Using a delegate
      3. More on protocols
    4. Bronze Challenge: Disallow Alphabetic Characters
  9. 5. View Controllers
    1. The View of a View Controller
    2. Setting the Initial View Controller
    3. UITabBarController
      1. Tab bar items
    4. Loaded and Appearing Views
      1. Accessing subviews
    5. Interacting with View Controllers and Their Views
    6. Silver Challenge: Dark Mode
    7. For the More Curious: Retina Display
  10. 6. Programmatic Views
    1. Creating a View Programmatically
    2. Programmatic Constraints
      1. Anchors
      2. Activating constraints
      3. Layout guides
      4. Margins
      5. Explicit constraints
    3. Programmatic Controls
    4. Bronze Challenge: Another Tab
    5. Silver Challenge: User’s Location
    6. Gold Challenge: Dropping Pins
    7. For the More Curious: NSAutoresizingMaskLayoutConstraint
  11. 7. Localization
    1. Internationalization
      1. Formatters
      2. Base internationalization
      3. Preparing for localization
    2. Localization
      1. NSLocalizedString and strings tables
    3. Bronze Challenge: Another Localization
    4. For the More Curious: NSBundle’s Role in Internationalization
    5. For the More Curious: Importing and Exporting as XLIFF
  12. 8. Controlling Animations
    1. Basic Animations
      1. Closures
    2. Another Label
    3. Animation Completion
    4. Animating Constraints
    5. Timing Functions
    6. Bronze Challenge: Spring Animations
    7. Silver Challenge: Layout Guides
  13. 9. UITableView and UITableViewController
    1. Beginning the Homepwner Application
    2. UITableViewController
      1. Subclassing UITableViewController
    3. Creating the Item Class
      1. Custom initializers
    4. UITableView’s Data Source
      1. Giving the controller access to the store
      2. Implementing data source methods
    5. UITableViewCells
      1. Creating and retrieving UITableViewCells
      2. Reusing UITableViewCells
    6. Content Insets
    7. Bronze Challenge: Sections
    8. Silver Challenge: Constant Rows
    9. Gold Challenge: Customizing the Table
  14. 10. Editing UITableView
    1. Editing Mode
    2. Adding Rows
    3. Deleting Rows
    4. Moving Rows
    5. Displaying User Alerts
    6. Design Patterns
    7. Bronze Challenge: Renaming the Delete Button
    8. Silver Challenge: Preventing Reordering
    9. Gold Challenge: Really Preventing Reordering
  15. 11. Subclassing UITableViewCell
    1. Creating ItemCell
    2. Exposing the Properties of ItemCell
    3. Using ItemCell
    4. Dynamic Cell Heights
    5. Dynamic Type
      1. Responding to user changes
    6. Bronze Challenge: Cell Colors
  16. 12. Stack Views
    1. Using UIStackView
      1. Implicit constraints
        1. Content hugging priorities
        2. Content compression resistance priorities
      2. Stack view distribution
      3. Nested stack views
      4. Stack view spacing
    2. Segues
    3. Hooking Up the Content
    4. Passing Data Around
    5. Bronze Challenge: More Stack Views
  17. 13. UINavigationController
    1. UINavigationController
    2. Navigating with UINavigationController
    3. Appearing and Disappearing Views
    4. Dismissing the Keyboard
      1. Event handling basics
      2. Dismissing by pressing the Return key
      3. Dismissing by tapping elsewhere
    5. UINavigationBar
      1. Adding buttons to the navigation bar
    6. Bronze Challenge: Displaying a Number Pad
    7. Silver Challenge: A Custom UITextField
    8. Gold Challenge: Pushing More View Controllers
  18. 14. Camera
    1. Displaying Images and UIImageView
      1. Adding a camera button
    2. Taking Pictures and UIImagePickerController
      1. Setting the image picker’s sourceType
      2. Setting the image picker’s delegate
      3. Presenting the image picker modally
      4. Saving the image
    3. Creating ImageStore
    4. Giving View Controllers Access to the Image Store
    5. Creating and Using Keys
    6. Wrapping Up ImageStore
    7. Bronze Challenge: Editing an Image
    8. Silver Challenge: Removing an Image
    9. Gold Challenge: Camera Overlay
    10. For the More Curious: Navigating Implementation Files
      1. // MARK:
  19. 15. Saving, Loading, and Application States
    1. Archiving
    2. Application Sandbox
      1. Constructing a file URL
    3. NSKeyedArchiver and NSKeyedUnarchiver
      1. Loading files
    4. Application States and Transitions
    5. Writing to the Filesystem with NSData
    6. Error Handling
    7. Bronze Challenge: PNG
    8. For the More Curious: Application State Transitions
    9. For the More Curious: Reading and Writing to the Filesystem
    10. For the More Curious: The Application Bundle
  20. 16. Size Classes
    1. Another Size Class
    2. Bronze Challenge: Stacked Text Field and Labels
  21. 17. Touch Events and UIResponder
    1. Touch Events
    2. Creating the TouchTracker Application
    3. Creating the Line Struct
      1. Structs
      2. Value types vs. reference types
    4. Creating DrawView
    5. Drawing with DrawView
    6. Turning Touches into Lines
      1. Handling multiple touches
    7. @IBInspectable
    8. Silver Challenge: Colors
    9. Gold Challenge: Circles
    10. For the More Curious: The Responder Chain
    11. For the More Curious: UIControl
  22. 18. UIGestureRecognizer and UIMenuController
    1. UIGestureRecognizer Subclasses
    2. Detecting Taps with UITapGestureRecognizer
    3. Multiple Gesture Recognizers
    4. UIMenuController
    5. More Gesture Recognizers
      1. UILongPressGestureRecognizer
      2. UIPanGestureRecognizer and simultaneous recognizers
    6. More on UIGestureRecognizer
    7. Silver Challenge: Mysterious Lines
    8. Gold Challenge: Speed and Size
    9. Platinum Challenge: Colors
    10. For the More Curious: UIMenuController and UIResponderStandardEditActions
  23. 19. Web Services
    1. Starting the Photorama Application
    2. Building the URL
      1. Formatting URLs and requests
      2. NSURLComponents
    3. Sending the Request
      1. NSURLSession
    4. Modeling the Photo
    5. JSON Data
      1. NSJSONSerialization
      2. Enumerations and associated values
      3. Parsing JSON data
    6. Downloading and Displaying the Image Data
    7. The Main Thread
    8. Bronze Challenge: Printing the Response Information
    9. For the More Curious: HTTP
  24. 20. Collection Views
    1. Displaying the Grid
    2. Collection View Data Source
    3. Customizing the Layout
    4. Creating a Custom UICollectionViewCell
    5. Downloading the Image Data
      1. Extensions
    6. Navigating to a Photo
    7. Silver Challenge: Updated Item Sizes
    8. Gold Challenge: Creating a Custom Layout
  25. 21. Core Data
    1. Object Graphs
    2. Entities
      1. Modeling entities
      2. Transformable attributes
      3. NSManagedObject and subclasses
    3. Building the Core Data Stack
      1. NSManagedObjectModel
      2. NSPersistentStoreCoordinator
      3. NSManagedObjectContext
    4. Updating Items
      1. Inserting into the context
      2. Saving changes
    5. Updating the Data Source
      1. Fetch requests and predicates
    6. Saving Images to Disk
    7. Bronze Challenge: Photo View Count
  26. 22. Core Data Relationships
    1. Relationships
    2. Adding Tags to the Interface
    3. Parent-Child Contexts
    4. Silver Challenge: Favorites
  27. 23. Afterword
    1. What to Do Next
    2. Shameless Plugs
  28. Index