O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

iOS Programming: The Big Nerd Ranch Guide, 6th Edition

Book Description

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