Learn iOS 8 App Development, Second Edition

Book description

Learn iOS 8 App Development is both a rapid tutorial and a useful reference. You'll quickly get up to speed with Objective-C, Cocoa Touch, and the iOS 8 SDK. It's an all-in-one getting started guide to building useful apps. You'll learn best practices that ensure your code will be efficient and perform well, earning positive reviews on the iTunes App Store, and driving better search results and more revenue.

The iOS 8 SDK offers powerful new features, and this book is the fastest path to mastering them—and the rest of the iOS SDK —for programmers with some experience who are new to iPhone and iPad app development. Many books introduce the iOS SDK, but few explain how to develop apps optimally and soundly. This book teaches both core Objective-C language concepts and how to exploit design patterns and logic with the iOS SDK, based on Objective-C and the Cocoa Touch framework.

Why spend months or years discovering the best ways to design and code iPhone and iPad apps when this book will show you how to do things the right way from the start?

  • Get an accelerated treatment of the core fundamentals of Objective-C.
  • Develop your first app using Xcode's advanced interface design tools.
  • Build your first iPhone app using the code that you're given as you walk through this book.
  • Finally, debug and distribute your first app on Apple's iTunes App Store.
  • Learn how to create apps for any model of iPhone, the iPod Touch, the iPad, or build universal apps that run on all of them. After reading this book, you'll be creating professional quality apps, ready to upload to the app store, making you the prestige and the money you seek!

    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. Introduction
    11. Chapter 1: Got Tools?
      1. Requirements
      2. Installing Xcode
      3. What Is Xcode?
      4. Becoming an iOS Developer
      5. Getting the Projects
      6. Launching Xcode the First Time
      7. Welcome to Xcode
        1. Navigation Area
        2. Editor Area
        3. Utility Area
        4. Debug Area
        5. Toolbar
      8. Running Your First App
      9. Summary
    12. Chapter 2: Boom! App
      1. Design
      2. Creating the Project
      3. Setting Project Properties
      4. Building an Interface
        1. Adding Objects
        2. Deleting and Connecting Objects
        3. Adding Views to a View
        4. Editing Object Properties
        5. Adding Resources
        6. Customizing Buttons
      5. Using Storyboards
        1. Adding New Scenes
        2. Creating a Segue
        3. Setting Navigation Titles
      6. Testing Your Interface
      7. Debugging Your App
        1. Adding Basic Constraints
        2. Adding Missing Constraints
        3. Editing Constraint Objects
        4. Adding Relationship Constraints
      8. Finishing Your App
      9. Summary
    13. Chapter 3: Spin a Web
      1. Design
      2. Creating the Project
      3. Building a Web Browser
      4. Coding a Web Browser
        1. Adding Outlets to ViewController
        2. Connecting Custom Outlets
        3. Adding Actions to ViewController
        4. Setting Action Connections
        5. Testing the Web Browser
        6. Debugging the Web View
      5. Adding URL Shortening
        1. Designing the URL Shortening Code
        2. Becoming a Web View Delegate
        3. Shortening a URL
      6. Final Touches
        1. Cleaning Up the Interface
      7. Summary
    14. Chapter 4: Coming Events
      1. Run Loop
      2. Event Queue
      3. Event Delivery
        1. Direct Delivery
        2. Hit Testing
        3. The First Responder
      4. Event Handling
      5. The Responder Chain
      6. High-Level vs. Low-Level Events
      7. Eight Ball
        1. Design
        2. Create the Project
        3. Create the Interface
        4. Writing the Code
        5. Handling Shake Events
        6. Testing Your EightBall App
        7. Finishing Touches
      8. Testing on a Physical iOS Device
      9. Other Uses for the Responder Chain
      10. Touchy
        1. Design
        2. Creating the Project
        3. Creating a Custom View
        4. Handling Touch Events
        5. Drawing Your View
        6. Adding Custom Objects in Interface Builder
        7. Testing Touchy
      11. Advanced Event Handling
      12. Summary
    15. Chapter 5: Table Manners
      1. Table Views
        1. Plain Tables
        2. Grouped Tables
        3. Cell Styles
        4. Cell Accessories
        5. Custom Cells
      2. How Table Views Work
        1. Table Cells and Rubber Stamps
      3. MyStuff
        1. Design
        2. Creating the Project
        3. Creating Your Data Model
        4. Creating a Data Source
        5. Implementing Your Rubber Stamp
        6. Table Cell Caching
        7. Where’s the Beef?
        8. Testing MyStuff
      4. Adding the Detail View
        1. Creating the Detail View
        2. Configuring the Detail View
      5. Editing
        1. Inserting and Removing Items
        2. Enabling Table Editing
        3. Editing Details
        4. Observing Changes to MyWhatsit
      6. Modal vs. Modeless Editing
      7. Little Touches
      8. Advanced Table View Topics
      9. Summary
    16. Chapter 6: Object Lesson
      1. Two Houses, Both Alike in Dignity
      2. Romeo Meets Juliet
      3. Classes and Cookies
      4. Classes and Objects and Methods, Oh My!
      5. Inheritance
        1. Abstract and Concrete Classes
        2. Overriding Methods
      6. Design Patterns and Principles
        1. Encapsulation
        2. Singularity of Purpose
        3. Stability
        4. Open/Closed
        5. Delegation
        6. Other Patterns
      7. Summary
    17. Chapter 7: Smile!
      1. Design
      2. Extending Your Design
        1. Revising the Data Model
        2. Adding an Image View
        3. Updating the View Controller
        4. Connecting a Choose Image Action
      3. Taking Pictures
        1. You Can’t Always Get What You Want
        2. Presenting the Image Picker
        3. Importing the Image
        4. Cropping and Resizing
        5. Winding Up
        6. Testing the Camera
      4. Handling Regular Interfaces
      5. Sticky Keyboards
      6. Advanced Camera Techniques
      7. Summary
    18. Chapter 8: Model Citizen
      1. The Model-View-Controller Design Pattern
        1. Data Model Objects
        2. View Objects
        3. Controller Objects
        4. MVC Communications
      2. Color Model
        1. Creating Your Data Model
        2. Creating View Objects
        3. Writing Your Controller
        4. Wiring Your Interface
      3. Having Multiple Views
      4. Consolidating Updates
      5. Complex View Objects
      6. Replacing UIView with ColorView
        1. Connecting the View to Your Data Model
        2. Drawing ColorView
      7. Being a Keen Observer
        1. Key-Value Observing
        2. Observing Key Value Changes
        3. Creating KVO Dependencies
      8. Multivector Data Model Changes
        1. Handling Touch Events
        2. Binding the Sliders
        3. Final Touches
      9. Cheating
      10. Summary
    19. Chapter 9: Sweet, Sweet Music
      1. Making Your Own iPod
        1. Design
        2. Adding a Music Picker
        3. Using a Music Player
        4. Adding Playback Control
        5. Receiving Music Player Notifications
        6. Adding Media Metadata
        7. Observing the Playing Item
      2. Make Some Noise
        1. Living in a Larger World
        2. Configuring Your Audio Session
        3. Playing Audio Files
        4. Creating AVAudioPlayer Objects
        5. Adding the Sound Buttons
        6. Making Noise
        7. Activating Your Audio Session
      3. Interruptions and Detours
        1. Dealing with Interruptions
        2. Adding Your Interruption Handlers
        3. Dealing with Audio Route Changes
      4. Other Audio Topics
      5. Summary
    20. Chapter 10: Got Views?
      1. Learning by Example
      2. Buttons
        1. The Responder and View Classes
        2. The Control Class
        3. Button Types
        4. Control States
        5. Button Code
      3. Switches and Sliders
      4. Page Control
      5. Steppers
      6. Segmented Controls
      7. Progress Indicators
      8. Text Views
        1. Labels
        2. Text Fields
        3. Text Editing Behavior
        4. Text Views
      9. Search Bars
      10. Pickers
        1. Date Picker
        2. Anything Picker
      11. Image Views
      12. Grouped Tables
      13. The View You Never See
      14. Alert Controllers
      15. Summary
    21. Chapter 11: Draw Me a Picture
      1. Creating a Custom View Class
        1. View Coordinates
        2. When Views Are Drawn
        3. Drawing a View
      2. Shapely
        1. Creating Views Programmatically
        2. Initializing Your Object
        3. The drawRect(_:) Function
        4. More Shapes, More Colors
      3. Transforms
        1. Applying a Translate Transform
        2. Applying a Scale Transform
      4. Animation: It’s Not Just for Manga
        1. Using Core Animation
        2. Adding Animation to Shapely
        3. OpenGL, Sprite Kit, Scene Kit, and Metal
      5. The Order of Things
      6. Drawing Images
      7. Advanced Graphics
        1. Text
        2. Shadows, Gradients, and Patterns
        3. Blend Modes
        4. The Context Stack
      8. Summary
    22. Chapter 12: There and Back Again
      1. Measure Twice, Cut Once
        1. What Is Navigation?
        2. View Controller Roles
      2. Designing Wonderland
        1. Weighing Your Navigation Options
        2. Wonderland Navigation
      3. Creating Wonderland
        1. Adding Wonderland’s Resources
        2. Configuring a Tab Bar Item
      4. The First Content View Controller
      5. Creating a Navigable Table View
        1. Breathing Data Into Your Table View
        2. Pushing the Detail View Controller
      6. Creating a Page View Controller
        1. Adding the Page View Controllers
        2. Designing a Prototype Page
        3. Coding the One Page View Controller
        4. Coding the Page View Data Source
        5. Initializing a Page View Controller
      7. Presenting View Controllers
        1. Presentation Controllers
        2. Presenting a Modal View Controller
      8. Adapting View Controller Content
        1. Smarter Than the Average Bear
        2. Using Trait Collections
        3. Adding Adaptive Constraints (and Objects)
        4. Adapting View Programmatically
        5. Animating Layout Changes
      9. Advanced View Controller Topics
        1. Custom Presentations and Transitions
        2. Appearance Proxies
      10. Summary
    23. Chapter 13: Sharing Is Caring
      1. Color My (Social) World
        1. Having Something to Share
        2. Presenting the Activity View Controller
      2. The More You Share, the More You Get
        1. Refactoring drawRect(_:)
        2. Providing More Items to Share
        3. Excluding Activities
      3. The Curse of the Lowest Common Denominator
        1. Providing Activity-Specific Data
        2. Promises, Promises
        3. Big Data
      4. Inventing Your Own Activities
      5. Sharing with Specific Services
      6. Other Social Network Interactions
      7. Summary
    24. Chapter 14: Game On!
      1. SpaceSalad
        1. A Brief Tour of SpriteKit
        2. Making the Scene
      2. Adding Sprites
        1. Resizing a Scene
      3. Let’s Get Physical
        1. Setting Boundaries
        2. Adding Obstacles
      4. Interacting with the Player
        1. Responding to Touch
      5. Sprites on a Plane
      6. Nodes That Go Bump
      7. Contact!
      8. Gamifying SpaceSalad
        1. Actions in Action
        2. Traditional Animation
      9. Presenting Scenes
      10. Beyond SpaceSalad
      11. Summary
    25. Chapter 15: If You Build It…
      1. How Interface Builder Files Work
        1. Compiling Interface Builder Files
        2. Loading a Scene
        3. Loading an .xib File
        4. Placeholder Objects and the File’s Owner
      2. Creating Objects
        1. Editing Attributes
      3. Creating Custom Objects
      4. Connections
        1. Making Action Connections
        2. Sending Action Messages
      5. Taking Control of Interface Builder Files
        1. Declaring Placeholders
        2. Designing ShapeView
        3. Connecting the Gesture Recognizers
        4. Building Your Shape Factory
        5. Loading an Interface Builder File
        6. Replacing Code
      6. Summary
    26. Chapter 16: Apps with Attitude
      1. Leveler
        1. Creating Leveler
      2. Getting Motion Data
        1. Creating CMMotionManager
        2. Starting and Stopping Updates
        3. Push Me, Pull You
        4. Timing Is Everything
        5. Herky-Jerky
      3. Getting Other Kinds of Motion Data
        1. Gyroscope Data
        2. Magnetometer Data
        3. Device Motion and Attitude
        4. Measuring Change
      4. Summary
    27. Chapter 17: Where Are You?
      1. Creating Pigeon
      2. Collecting Location Data
        1. Asking for Permission
        2. Starting Location Collection
      3. Using a Map View
      4. Decorating Your Map
        1. Adding an Annotation
        2. Map Coordinates
        3. Adding a Little Bounce
      5. Showing the Way Home
        1. Adding Overlays
        2. Providing the Renderer
      6. Location Monitoring
        1. Approximate Location and Non-GPS Devices
        2. Monitoring Regions
        3. Reducing Location Change Messages
        4. Movement and Heading
      7. Geocoding
      8. Getting Directions
      9. Summary
    28. Chapter 18: Remember Me?
      1. Property Lists
      2. Serializing Property Lists
      3. User Defaults
      4. Making Pigeon Remember
        1. Minimizing Updates and Code
        2. Defining Your Keys
        3. Writing Values to User Defaults
        4. Getting Values from User Defaults
        5. Testing User Defaults
      5. Registering Default Values
      6. Turning Objects into Property List Objects
        1. Preserving and Restoring savedLocation
      7. Persistent Views
        1. Fading Into the Background
        2. Preserving View Controllers
        3. Assigning Restoration Identifiers
        4. Customizing Restoration
        5. Deeper Restoration
      8. Pigeons in the Cloud
        1. Storing Values in the Cloud
        2. Cloud Watching
        3. Enabling iCloud
        4. Testing the Cloud
      9. Bundle Up Your Settings
        1. Creating a Settings Bundle
        2. Using Your Settings Bundle Values
        3. Testing Your Settings Bundle
      10. Summary
    29. Chapter 19: Doc, You Meant Storage
      1. Document Overview
      2. Where, Oh Where, Do My Documents Go?
      3. MyStuff on Documents
      4. Supplying Your Document’s Data
        1. Wrapping Up Your Data
        2. Using Wrappers
        3. Incremental Document Updates
        4. Constructing Your Wrappers
        5. Interpreting Your Wrappers
      5. Archiving Objects
        1. Adopting NSCoding
        2. Archiving and Unarchiving Objects
        3. The Archiving Serialization Smackdown
        4. Serialization, Meet Archiving
      6. Document, Meet Your Data Model
      7. Tracking Changes
      8. Testing Your Document
        1. Setting Breakpoints
        2. Stepping Through Code and Examining Variables
        3. Creating a ThingsDocument Delegate
      9. Storing Image Files
      10. Odds and Ends
        1. iCloud Storage
        2. Archive Versioning
      11. Summary
    30. Chapter 20: See Swift, See Swift Run
      1. The (Short) History of Swift
      2. Classes
        1. Playgrounds
        2. Properties
        3. Methods
        4. Inheritance
        5. Object Creation
      3. Closures
        1. Capturing self
        2. Using Closures
        3. Closure Shortcuts
      4. Protocols
      5. Extensions
      6. Structures
      7. Tuples
      8. Enumerations
        1. Raw Values
        2. Associated Values
        3. Extended Enumerations
      9. Numeric Values
        1. Implicit Type Conversion
        2. Numeric Literals
        3. Numbers Are Types Too
        4. Overflow and Underflow
      10. Strings and Characters
        1. String and Character Literals
        2. Unicode
        3. String Interpolation
        4. Strings Are NSStrings
        5. String Concatenation
        6. Attributed Strings
      11. Collections
      12. Control Statements
        1. for Loop
        2. switch Statement
      13. Optionals
        1. Using Optionals
        2. Optionals Carry
        3. Optional Chaining
        4. Failable Initializers
        5. Implicit Unwrapping
      14. Type Casting
        1. Downcasting
        2. Downcasting Collections
      15. Value vs. Reference vs. Constant vs. Variable
        1. let and var References
        2. var Parameters
        3. References to Values (inout)
      16. Working with C and Objective-C
        1. The Toll-Free Bridge
        2. Method Signatures
      17. Memory Management
        1. Garbage Collection
        2. Reference Counting
        3. Circular Retains
      18. Even More Swift
      19. Summary
    31. Chapter 21: Frame Up
      1. Extensions
        1. Creating an Extension
        2. Connecting Your Extension
        3. Running your Action
      2. Lights, Code, Action
        1. Every Extension Is an Island
        2. Obtaining the User’s Data
        3. Reusing Squeezer
      3. Action Icons
      4. Reusing Squeezer, for Real
        1. Creating a Framework
        2. Adding Code to a Framework
        3. Sharing a Framework with an Extension
      5. Summary
    32. Index

    Product information

    • Title: Learn iOS 8 App Development, Second Edition
    • Author(s):
    • Release date: December 2014
    • Publisher(s): Apress
    • ISBN: 9781484202081