Learn Objective-C on the Mac: For OS X and iOS, Second Edition

Book description

Learn to write apps for some of today's hottest technologies, including the iPhone and iPad (using iOS), as well as the Mac (using OS X). It starts with Objective-C, the base language on which the native iOS software development kit (SDK) and the OS X are based. Learn Objective-C on the Mac: For OS X and iOS, Second Edition updates a best selling book and is an extensive, newly updated guide to Objective-C.

Objective-C is a powerful, object-oriented extension of C, making this update the perfect follow-up to Dave Mark's bestselling Learn C on the Mac. Whether you're an experienced C programmer or you're coming from a different language such as C++ or Java, leading Mac experts Scott Knaster and Waqar Malik show how to harness the power of Objective-C in your apps!

  • A complete course on the basics of Objective-C using Apple's newest Xcode tools

  • An introduction to object-oriented programming

  • Comprehensive coverage of new topics like blocks, GCD, ARC, class extensions, as well as inheritance, composition, object initialization, categories, protocols, memory management, and organizing source files

  • An introduction to building user interfaces using what is called the UIKit

  • A primer for non-C programmers to get off the ground even faster

  • What you'll learn

  • Learn Objective-C programming, the gateway to programming your iPhone, iPad or Mac

  • Write apps for the iOS and/or OS X interfaces, the cleanest user-interfaces around

  • Understand variables and how to design your own data structures

  • Work with the new Objective-C features now available in this update like blocks, automated reference counting (ARC) and class extensions

  • Work with new tools available like Clang static analyzer and Grand Central Dispatch (GCD)

  • Undertand UIKit and how to build simple user interfaces easily and effectively

  • Explore using the latest Xcode

  • Who this book is for

    For anyone wanting to learn to program native apps in iOS and/or OS X, including developers new to the iOS-based iPhone and iPad as well as OS X-based Mac computers. This book is for developers new to Objective-C, but who have some programming experience.

    Table of contents

    1. Title Page
    2. Dedication
    3. Contents at a glance
    4. Contents
    5. Foreword
    6. About the Authors
    7. About the Technical Reviewer
    8. Acknowledgments
    9. Working with This Book
    10. Chapter 1: Hello
      1. Before You Start
      2. Where the Future Was Made Yesterday
      3. What’s Coming Up
      4. Getting Ready
      5. Summary
    11. Chapter 2: Extensions to C
      1. The Simplest Objective-C Program
      2. Deconstructing Hello Objective-C
      3. Are You the Boolean Type?
      4. Summary
    12. Chapter 3: Introduction to Object-Oriented Programming
      1. It’s All Indirection
      2. Using Indirection in Object-Oriented Programming
      3. Time Out for Terminology
      4. OOP in Objective-C
      5. Summary
    13. Chapter 4: Inheritance
      1. Why Use Inheritance?
      2. Inheritance Syntax
      3. How Inheritance Works
      4. Overriding Methods
      5. Summary
    14. Chapter 5: Composition
      1. What Is Composition?
      2. Customizing for NSLog()
      3. Accessor Methods
      4. Extending CarParts
      5. Composition or Inheritance?
      6. Summary
    15. Chapter 6: Source File Organization
      1. Split Interface and Implementation
      2. Breaking Apart the Car
      3. Using Cross-File Dependencies
      4. Summary
    16. Chapter 7: More About Xcode
      1. One Window to Rule Them All
      2. Changing the Company Name
      3. Using Editor Tips and Tricks
      4. Writing Your Code with a Little Help from Xcode
      5. Debugging
      6. Cheat Sheet
      7. Summary
    17. Chapter 8: A Quick Tour of the Foundation Kit
      1. Solid Foundation
      2. Using the Project Boilerplate Code
      3. Some Useful Types
      4. Stringing Us Along
      5. Collection Agency
      6. Family Values
      7. Example: Looking for Files
      8. Summary
    18. Chapter 9: Memory Management
      1. Object Life Cycle
      2. The Rules of Cocoa Memory Management
      3. Being Exceptional
      4. Summary
    19. Chapter 10: Object Initialization
      1. Allocating Objects
      2. Isn’t That Convenient?
      3. More Parts Is Parts
      4. Car Cleaning, GC and ARC Style
      5. The Designated Initializer
      6. Initializer Rules
      7. Summary
    20. Chapter 11: Properties
      1. Shrinking Property Values
      2. Objecting to Properties
      3. Summary
    21. Chapter 12: Categories
      1. Creating a Category
      2. Splitting an Implementation with Categories
      3. Making Forward References with Categories
      4. Informal Protocols and Delegation Categories
    22. Chapter 13: Protocols
      1. Formal Protocols
      2. Car-bon Copies
      3. Objective-C 2.0 Goodies
      4. The Delegation Will Come to Order
      5. Summary
    23. Chapter 14: Blocks and Concurrency
      1. You’re Never Too Old to Play with Blocks
      2. Concurrency, or Keeping Up with Yourself
    24. Chapter 15: Introduction to UIKit
      1. View Controllers
      2. Summary
    25. Chapter 16: Introduction to the Application Kit
      1. Making the Project
      2. Making the Delegate @interface
      3. Interface Builder
      4. Laying Out the User Interface
      5. Making Connections
      6. AppDelegate Implementation
      7. Summary
    26. Chapter 17: File Loading and Saving
      1. Property Lists
      2. Encoding Objects
      3. Summary
    27. Chapter 18: Key-Value Coding
      1. A Starter Project
      2. Introducing KVC
      3. A Path! A Path!
      4. Aggregated Assault
      5. Life’s a Batch
      6. The Nils Are Alive
      7. Handling the Unhandled
      8. Summary
    28. Chapter 19: Using the Static Analyzer
      1. Getting Some Static
      2. Summary
    29. Chapter 20: NSPredicate
      1. Creating a Predicate
      2. Evaluate the Predicate
      3. Fuel Filters
      4. Format Specifiers
      5. Hello Operator, Give Me Number 9
      6. SELF Sufficient
      7. String Operations
      8. Like, Fer Sure
      9. That’s All, Folks
    30. Appendix A: Coming to Objective-C from Other Languages
    31. Index

    Product information

    • Title: Learn Objective-C on the Mac: For OS X and iOS, Second Edition
    • Author(s):
    • Release date: June 2012
    • Publisher(s): Apress
    • ISBN: 9781430241881