Core Objective-C in 24 Hours
By Keith Lee
5/5
()
About this ebook
Core Objective-C in 24 Hours provides a clear and concise overview of the programming language, describes its key features and APIs, and presents recommendations for developing iOS and OS X apps using Objective-C. It is written for readers who want a general understanding of Apple Objective-C technology on the Mac along with developers who want to quickly get started with the language. Very quickly, you will have a solid understanding of Objective-C and be ready to begin using it on your projects!
The book is divided into two parts; Part One provides an introduction to object-oriented programming with Objective-C, describes the software development environment for the OS X and iOS platforms, and summarizes key features of the language. Part Two is more focused on application development - it features an in-depth look at the principal components of Objective-C programs, along with a detailed review of the key frameworks and services used for Objective-C application development. The Appendix contains additional details on the language along with some useful recommendations for programming with Objective-C.
Keith Lee
Keith Lee is a noted composer, author, and technologist. He has composed numerous works for both soloists and diverse ensembles. He also has over 20 years of experience designing and implementing information systems.
Read more from Keith Lee
Swift Programming Nuts and bolts Rating: 0 out of 5 stars0 ratingsiOS Programming Nuts and bolts Rating: 4 out of 5 stars4/5Programming for Everyone Rating: 3 out of 5 stars3/5Objective-C Programming Nuts and bolts Rating: 0 out of 5 stars0 ratings
Related to Core Objective-C in 24 Hours
Related ebooks
Swift 3 Object-Oriented Programming - Second Edition Rating: 0 out of 5 stars0 ratingsClojure Reactive Programming Rating: 0 out of 5 stars0 ratingsLearning SQLite for iOS Rating: 0 out of 5 stars0 ratingsTest-Driven iOS Development with Swift Rating: 5 out of 5 stars5/5Modern Web Development with Deno: Develop Modern JavaScript and TypeScript Code with Svelte, React, and GraphQL (English Edition) Rating: 0 out of 5 stars0 ratingsDesign Patterns in C#: A Hands-on Guide with Real-world Examples Rating: 0 out of 5 stars0 ratingsThe Way to Go: A Thorough Introduction to the Go Programming Language Rating: 2 out of 5 stars2/5Mastering C# Concurrency Rating: 0 out of 5 stars0 ratingsOpa Application Development Rating: 0 out of 5 stars0 ratingsBuilding Scalable Apps with Redis and Node.js Rating: 0 out of 5 stars0 ratingsApplication Development with Swift Rating: 0 out of 5 stars0 ratingsSwift Functional Programming - Second Edition Rating: 3 out of 5 stars3/5iOS Development with SwiftUI: Acquire the Knowledge and Skills to Create iOS Applications Using SwiftUI, Xcode 13, and UIKit Rating: 0 out of 5 stars0 ratingsSwift Cookbook Rating: 5 out of 5 stars5/5Swift by Example Rating: 1 out of 5 stars1/5Swift High Performance Rating: 4 out of 5 stars4/5Metaprogramming in .NET Rating: 5 out of 5 stars5/5iOS 10 Programming for Beginners Rating: 5 out of 5 stars5/5Swift Essentials Rating: 0 out of 5 stars0 ratingsMultithreading in C# 5.0 Cookbook Rating: 0 out of 5 stars0 ratingsMastering Windows Presentation Foundation Rating: 4 out of 5 stars4/5Swift 2 Design Patterns Rating: 0 out of 5 stars0 ratingsWindows Presentation Foundation 4.5 Cookbook Rating: 0 out of 5 stars0 ratingsOpenGL Development Cookbook Rating: 5 out of 5 stars5/5Practical XMPP Rating: 0 out of 5 stars0 ratingsBoost.Asio C++ Network Programming - Second Edition Rating: 0 out of 5 stars0 ratingsObjective-C Fundamentals Rating: 0 out of 5 stars0 ratingsGetting Started with WebRTC Rating: 0 out of 5 stars0 ratings
Programming For You
HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5SQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Python QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsPython Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsModern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratingsProgramming Arduino: Getting Started with Sketches Rating: 4 out of 5 stars4/5Problem Solving in C and Python: Programming Exercises and Solutions, Part 1 Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5
Reviews for Core Objective-C in 24 Hours
1 rating0 reviews
Book preview
Core Objective-C in 24 Hours - Keith Lee
Core Objective-C in 24 Hours
By Keith Lee
Published by Motu Presse Publications at Smashwords
Copyright 2012 Keith Lee
Smashwords Edition
Discover other titles by Keith Lee at Smashwords.com:
The Composer-Performer Relationship in Contemporary Music
Smashwords Edition, License Notes
This eBook is licensed for your personal enjoyment only. This eBook may not be re-sold or given away to other people. If you would like to share this book with another person, please purchase an additional copy for each recipient. If you’re reading this book and did not purchase it, or it was not purchased for your use only, then please return to Smashwords.com and purchase your own copy. Thank you for respecting the hard work of this author.
No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the author and publisher assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
ISBN: 978-1-4658-7539-6
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is
basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.
The source code for examples that accompany this book, as well as other resources, is available at www.motupresse.com.
Table of Contents
Prologue
Chapter 1 - Introduction
How to Use This Book
Chapter 2 - Getting Started
Programming Language
Development Environment
Chapter 3 - Developer Tools
Mac SDK
iOS SDK
Xcode
3rd Party Tools
Chapter 4 - Key Features
Object Messaging
Encapsulation
Polymorphism
Inheritance
Dynamic Runtime
Memory Management
Chapter 5 - Application Structure
Preprocessor Elements
Variables
The Class Section
Properties
Methods
The Main Section
C Language Elements
Chapter 6 - Frameworks and Services
Cocoa and Cocoa Touch
Foundation Framework
Application Kit Framework
UI Kit Framework
Appendix
Language Elements
Understanding Variable Scope
Using NULL, nil, and NSNull
String Constants versus String Literals
Memory Management and Object Ownership
Using ARC
Understanding Properties
Using Categories
Message Selectors
Forwarding Declarations
Handling Errors
Concurrent Programming
Blocks
NSObject Methods
Creating a Project in Xcode
Next Steps
About the Author
Prologue
Core Objective-C in 24 Hours provides a clear and concise overview of the programming language, describes its key features and APIs, and presents recommendations for developing Objective-C programs on the Mac. Within 24 hours, the reader will have a solid understanding of Objective-C and be ready to begin using it on his/her projects.
So, let’s begin!
INTRODUCTION
Objective-C is the primary programming language for developing applications on Apple’s Mac OS X and iOS (iPod, iPhone, iPad) platforms. In recent years these platforms have become some of the most popular development environments for programmers. A key reason for their success is due, in fact, to the features of the Objective-C language itself. General users and IT professionals alike want to be able to quickly grasp the fundamentals of this technology and begin using it to build solutions. This book was written to help you acquire this knowledge by answering the following questions: 1) What do you need to know to understand the Objective-C language and its role within the Mac platforms?, 2) what do you need to begin developing Objective-C programs on the Mac?, and 3) how do you quickly transition to Objective-C from another programming language? Core Objective-C in 24 Hours provides these answers.
How to Use This Book
This book is divided into two parts. Part One provides an introduction to object-oriented programming with Objective-C, describes the software development environment for the Mac OS X and iOS platforms, and summarizes key features of the language. Part Two is more focused on application development - it features an in-depth look at the principal components of Objective-C programs, along with a detailed review of the key frameworks and services used for Objective-C application development. The Appendix contains additional details on the language along with some useful recommendations for programming with Objective-C.
Readers who want a general understanding of Objective-C technology on the Mac will probably focus more on Part One of the book (the Getting Started, Key Features, and Developer Tools chapters). Experienced developers looking to transition to Objective-C will tend to concentrate on Part Two (the Application Structure and Key Frameworks chapters along with the Appendix).
GETTING STARTED
How do you get started with a new programming language? The first steps include acquiring a basic understanding of the language and its key features, along with knowledge of the infrastructure, facilities and tools available for software development. We'll start to lay this foundation here.
Programming Language
Brad Cox and Tom Love created the Objective-C programming language in the early 1980s, with the primary goal of adding object-oriented extensions to the ANSI C programming language. Objective-C is actually a strict superset of C that has been extended with features to support object-oriented programming. These features (object orientation, dynamic types, and reflection) were derived from the Smalltalk programming language.
In 1996 Apple acquired NeXT Software; the NeXTstep/OPENSTEP system served as the basis for the current Apple operating system (Mac OS X). NeXTstep also provided built-in support for the Objective-C language.
Apple released the current version (2.0) of Objective-C in 2007. It added many new features to the language, including automatic memory management (garbage collection), declared and synthesized properties, dot notation, fast enumeration, exception support, runtime performance improvements, and 64-bit machine support.
The Object in Objective-C
Object-Oriented Programming (OOP), the motivation for the Objective-C language (i.e. the Object in Objective-C), is a style of structured programming that uses objects as the software's key logical elements. An object is a self-contained software entity; it is composed of both state (data) and behavior (operations). The operations that can be performed on an object include accessing and/or updating its data elements, performing computations (e.g. implementing algorithms, etc.), and invoking operations on other objects. At runtime an object-oriented program executes its logic by creating object instances and invoking the desired operations on these objects. In a nutshell, object-oriented software can be viewed as a collection of interacting objects.
You develop object-oriented software by structuring application logic as classes. A class functions as a specification that is used to dynamically create class instances, i.e. objects.
OOP simplifies the development of classes through object-oriented concepts such as subtyping (specifying a class based on the data and operations of another class, also known as inheritance) and composition (specifying a class based on combinations of other classes).
As an example, let's say you need to develop a program that will manipulate and draw geometric shapes. You can begin by using object-oriented