Objective-C Programmer's Reference

Book description

Objective-C Programmer's Reference provides the tools necessary to write software in Objective-C—the language of choice for developing iOS and OS X applications. Author Carlos Oliveira begins from the basic building blocks of the language. He shows how to create correct and efficient applications by applying your knowledge of object-oriented and structured programming. This book:

  • Takes you quickly through fundamental concepts such as interfaces and class implementations.

  • Provides a concise reference to the Foundation Framework that is all-important when programming in Objective-C.

  • Highlights key differences between Objective-C and other popular languages such as Java or Python.

  • Provides the fundamentals of Cocoa and Cocoa Touch, which are the standard for OS X and iOS development.

  • Objective-C Programmer's Reference makes extensive use of concepts already mastered by developers who are fluent in other languages such as C++, Java, Perl, and Python. The author's approach is logical and structured, and even novice developers will have an easy time absorbing the most important topics necessary to program in Objective-C.

    Objective-C Programmer's Reference is a book for professional developers in Objective-C, or those who are moving to Objective-C from other languages. The book is written for readers who lack the time to invest in more traditional books, which usually spend hundreds of pages to explain concepts that are part of the working programmer's standard vocabulary.

    What you'll learn

  • Grasp the basic syntax of the Objective-C language.

  • Create classes and methods in Objective-C.

  • Apply Objective-C's message-passing mechanism to simplify your code and avoid deep class hierarchies.

  • Store and access dynamic data through Objective-C's built-in, key-value system.

  • Make effective use of container classes such as arrays and dictionaries with their immutable and mutable versions.

  • Create simple applications for iPhones, iPads, Macbooks, and other iOS and Mac OS X devices.

  • Who this book is for

    Objective-C Programmer's Reference is for programmers in Objective-C who are looking for a handy reference to keep them on top of their game. The book is also designed for programmers moving to Objective-C from some other language, especially from another C-like language such as Java or C#, providing just that additional bit that is needed to transfer their expertise into Objective-C and get a leg up on creating applications for the iOS and OS X platforms underlying Apple's hugely successful devices such as the iPhone, iPad, and Macbook.

    Table of contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. Part 1: The Language
      1. Chapter 1: The C in Objective-C
        1. Simple Statements
        2. Variables
        3. Variable Types
        4. Floating Point Numbers
        5. Characters
        6. Comments
        7. Arithmetic Expressions
        8. Function Fundamentals
        9. Conditional Operations
        10. Loops
        11. Structures
        12. Pointers
        13. Arrays
        14. Summary
      2. Chapter 2: Classes
        1. Object-Oriented Programming
        2. Using Objects
        3. Creating New Objects
        4. Defining New Classes
        5. Instance Variables
        6. Adding and Defining Instance Methods
        7. Defining Class Methods
        8. Defining Properties
        9. Classes and File Structure
        10. Summary
      3. Chapter 3: Strings and Container Classes
        1. Strings
        2. The NSNumber Class
        3. Containers
        4. Arrays
        5. Adding Other Object Types to an NSArray
        6. Accessing an Array
        7. Mutable Arrays
        8. Dictionaries
        9. Summary
      4. Chapter 4: Categories and Protocols
        1. Categories
        2. Protocols
        3. Summary
      5. Chapter 5: Inheritance
        1. The Concept of Inheritance
        2. Inheritance and Overriding
        3. The Substitution Principle
        4. Class Clusters
        5. Preventing Subclassing
        6. Multiple Inheritance
        7. Summary
      6. Chapter 6: Blocks
        1. Introducing Blocks
        2. Declaring Blocks
        3. Reading Complex Block Declarations
        4. Passing Blocks as Parameters
        5. Accessing External Variables
        6. Read-Write Access to Local Variables
        7. Blocks and Memory Management
        8. Using Blocks with the Foundation Framework
        9. Summary
      7. Chapter 7: Dynamic Binding
        1. Method Selectors
        2. Target-Action on Cocoa
        3. Dynamically Responding to Messages
        4. Simulating Multiple Inheritance
        5. Avoiding Method Calls
        6. Summary
      8. Chapter 8: Memory Management
        1. Dealing with Memory Issues
        2. Allocating Memory
        3. Rules of Reference Counting
        4. The autorelease Method
        5. Using Properties
        6. Autorelease Pools
        7. Using ARC
        8. Summary
      9. Chapter 9: Key-Value Coding
        1. The Concept of Key-Value Coding
        2. KVC and Properties
        3. Using Structures
        4. Accessing Objects Through Key Paths
        5. Accessing Collections
        6. Responding To Undefined Keys
        7. KVC and KVO
        8. Summary
      10. Chapter 10: The File System
        1. Specifying Locations with NSURL
        2. Reading and Writing Text Files
        3. Reading and Writing Binary Data
        4. Using NSStream
        5. Summary
    10. Part 2: Reference
      1. Chapter 11: The Foundation Framework
        1. Fundamental Classes
        2. Collection Classes
        3. Summary
    11. Part 3: The Tools
      1. Chapter 12: The Compiler
        1. Using GCC and LLVM Compilers
        2. Changing Compiler Options in Xcode
        3. Running the Compiler from the Command Line
        4. Code Optimization
        5. ARC Support
        6. Compiling Objective-C++
        7. Summary
      2. Chapter 13: The Preprocessor
        1. Defining Macros
        2. Conditional Compilation
        3. The Import Mechanism
        4. Best Practices for Header Files
        5. Summary
      3. Chapter 14: Unit Testing
        1. Unit Test Frameworks
        2. Adding Unit Test Targets
        3. Creating New Tests
        4. Running Tests in Xcode
        5. OCUnit Assertion Macros
        6. Test-Driven Development
        7. Summary
      4. Chapter 15: Debugging
        1. General Debugging Strategies
        2. Debugging with Xcode
        3. The Command Line Debugger
        4. Debugging Memory Issues
        5. Additional Tools
        6. Summary
    12. Part 4: Writing Apps for OS X and iOS
      1. Chapter 16: Building OS X GUI Applications
        1. An Overview of UI Creation with Cocoa
        2. The Cocoa UI Hierarchy
        3. Using Xcode for UI Design
        4. Coding a UI Application with Objective-C
        5. Summary
      2. Chapter 17: Building iOS Apps
        1. iOS Programming
        2. UI Classes in iOS
        3. Setting Up a Cocoa Touch Project
        4. Testing with the iOS Simulator
        5. An Example iOS Application
        6. Summary
    13. Index

    Product information

    • Title: Objective-C Programmer's Reference
    • Author(s):
    • Release date: November 2013
    • Publisher(s): Apress
    • ISBN: 9781430259053