About this ebook
Objective-C Programming Nuts and bolts 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 includes a complete overview of the latest enhancements to the Objective-C language, including generics, nullability annotations, and other features. 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 iOS and OS X 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 book concludes with a summary and a list of useful references 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
Core Objective-C in 24 Hours Rating: 5 out of 5 stars5/5Programming for Everyone Rating: 3 out of 5 stars3/5Swift Programming Nuts and bolts Rating: 0 out of 5 stars0 ratingsiOS Programming Nuts and bolts Rating: 4 out of 5 stars4/5
Related to Objective-C Programming Nuts and bolts
Related ebooks
Objective-C Memory Management Essentials Rating: 0 out of 5 stars0 ratingsMastering C: A Comprehensive Guide to Proficiency in The C Programming Language Rating: 0 out of 5 stars0 ratingsCoding In C Decoded: Decoded, #1 Rating: 0 out of 5 stars0 ratingsLearn to Code with C: Program with the world's most popular language on your Raspberry Pi Rating: 5 out of 5 stars5/5Swift Data Structure and Algorithms Rating: 0 out of 5 stars0 ratingsC Programming Wizardry: From Zero to Hero in 10 Days: Programming Prodigy: From Novice to Virtuoso in 10 Days Rating: 0 out of 5 stars0 ratingsSwiftUI Essentials - iOS Edition: Learn to Develop iOS Apps Using SwiftUI, Swift 5 and Xcode 11 Rating: 0 out of 5 stars0 ratingsBasic Information About C language PDF Rating: 0 out of 5 stars0 ratingsSwift Cookbook Rating: 5 out of 5 stars5/5C++ Programming: From Novice to Expert in a Step-by-Step Journey Rating: 0 out of 5 stars0 ratingsC++17 STL Cookbook Rating: 3 out of 5 stars3/5Advanced C++ Interview Questions You'll Most Likely Be Asked Rating: 0 out of 5 stars0 ratingsMastering C++ Swiftly Rating: 0 out of 5 stars0 ratingsLearn Xcode Fast! - A Beginner's Guide To Programming in Xcode: How To Program, #3 Rating: 1 out of 5 stars1/5C Programming: Core Concepts and Techniques Rating: 0 out of 5 stars0 ratingsComputer Practices Using C++ Rating: 0 out of 5 stars0 ratingsJava: Beginner's Guide to Programming Code with Java: Java Computer Programming Rating: 0 out of 5 stars0 ratingsMission JavaScript Rating: 0 out of 5 stars0 ratingsRust Mini Reference: A Hitchhiker's Guide to the Modern Programming Languages, #5 Rating: 0 out of 5 stars0 ratingsJava Programming Rating: 0 out of 5 stars0 ratingsApplication Development with Swift Rating: 0 out of 5 stars0 ratingsModern C++ Programming: Including the recent standards C++11, C++17, C++20, C++23 Rating: 0 out of 5 stars0 ratingsLearning Swift Rating: 5 out of 5 stars5/5Professional C++ Rating: 2 out of 5 stars2/5Data Structures II Essentials Rating: 0 out of 5 stars0 ratingsLinux System Programming: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsLearning Concurrent Programming in Scala - Second Edition Rating: 0 out of 5 stars0 ratingsJava Design Patterns for Automation and Performance Rating: 4 out of 5 stars4/5Java Web Developer A Complete Guide Rating: 0 out of 5 stars0 ratings
Programming For You
SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL 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/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps 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: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5Learn Python in 10 Minutes Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsPYTHON PROGRAMMING Rating: 4 out of 5 stars4/5Beginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratingsPYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Algorithms For Dummies Rating: 4 out of 5 stars4/5Godot from Zero to Proficiency (Foundations): Godot from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5HTML, CSS, and JavaScript Mobile Development For Dummies Rating: 4 out of 5 stars4/5
Reviews for Objective-C Programming Nuts and bolts
0 ratings0 reviews
Book preview
Objective-C Programming Nuts and bolts - Keith Lee
Objective-C Programming Nuts and Bolts
By Keith Lee
Copyright 2015 Keith Lee
Smashwords Edition
Discover other titles by Keith Lee at Smashwords.com:
iOS Programming Nuts and Bolts
Swift Programming Nuts and Bolts
Programming for Everyone
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.
Objective-C Programming Nuts and Bolts
Motu Presse Publications
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 (electronic): 978-1-4951-7640-1
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
Preface
Introduction
Chapter 1: Getting Started
Programming Language
Development Environment
Developer Tools
Your First Objective-C Program
Chapter 2: Key Features
Object Messaging
Encapsulation
Polymorphism
Inheritance
Dynamic Runtime
Memory Management
Chapter 3: Application Structure
Preprocessor Elements
Variables
The Class Section
Properties
Methods
The Main Section
C Language Elements
Chapter 4: Basic Elements
Variables
Comments
Other Types
Operators
Expressions and Statements
Chapter 5: Objective-C Literals
NSNumber Literals
Container Literals
Expression Literals
Object Subscripting
Chapter 6: Blocks
Syntax
Usage
Block Objects
Chapter 7: Generics
Syntax
Usage
Chapter 8: Additional Topics
Understanding Variable Scope
Using NULL, nil, and NSNull
String Constants versus String Literals
MRR Memory Management
ARC Memory Management
Understanding Properties
Using Categories
Message Selectors
Forwarding Declarations
Handling Errors
Concurrent Programming
NSObject Methods
Chapter 9: Frameworks and Services
Cocoa and Cocoa Touch
Foundation Framework
Chapter 10: Resources
Chapter 11: NeXT Steps
About the Author
Preface
Objective-C Programming Nuts and Bolts provides a clear and concise overview of the programming language, describes its key features and APIs, and presents recommendations for developing iOS, watchOS, and OS X programs using Objective-C. Very quickly, 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 one of the standard programming languages for developing applications on Apple’s iOS, watchOS, and OS X platforms. In recent years these platforms have become some of the most popular development environments for programmers. 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 Apple technology ecosystem?, 2) what do you need to begin developing programs using Objective-C, and 3) how do you quickly transition to Objective-C from another programming language? Objective-C Programming Nuts and Bolts provides these answers.
Who This Book Is For
This book is for developers of all levels of expertise who have, at a minimum, knowledge of basic programming concepts. In addition knowledge of object-oriented programming concepts, while not necessary, is also useful.
What You Need
Before you begin writing Objective-C code for the Apple platforms, you’ll need an Intel-based Mac computer running OS X El Capitan (version 10.11) or later. You’ll also need Xcode 7 (or later), Apple’s toolset for software development using Objective-C.
How to Use This Book
This book is divided into three parts. Part One provides an introduction to object-oriented programming with Objective-C, describes the software development environment for the iOS, watchOS, and OS X 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. Part Three consists of final comments on this book along with references and recommendations that will be useful as you develop apps using Objective-C.
Readers who want a general understanding of Objective-C technology on the Apple platforms will probably focus more on Part One of the book (Chapters 1-2). Experienced developers looking to transition to Objective-C will tend to concentrate on Part Two (Chapters 3-9).
Typographical Conventions
The following typographical conventions are used in this book:
Bold font style within the body of text indicates significant words or phrases. Bold is also used to identify chapters or sections within a chapter.
Italics font style indicates new words or phrases that are explained further in the body of the book.
Monospaced, constant width font is used for programming code excerpts and examples.
Monospaced, constant width bold font is used within programming code excerpts and examples to indicate key elements and concepts.
Monospaced, constant width italic font is used within programming code excerpts to indicate comments.
Attention New Programmers!
Particularly for beginners, computer programming can be a little frustrating at first. Here are a few recommendations that will be very helpful when you start writing programs:
Proper syntax - It is very important that your program code has the correct syntax. Specifically, capitalization, spacing, and other syntax elements should be identical to that shown in this book and the reference documentation. In general computers and programming languages are very strict about syntax, so if you make typing errors your program will not run properly.
Check your work – Mistakes happen, so check your work frequently, particularly just before you run your programs.
One step at a time – Develop your programs incrementally. This means write small portions of code, test and fix errors until you verify the code works as expected, and add more code to your program accordingly.
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 (OS X). NeXTstep also provided built-in support for the Objective-C language.
Over the years Apple has released many new features to Objective-C to make programming with the language faster, safer, and more efficient. Some latest updates include automatic memory management, declared and synthesized properties, fast enumeration, exception support, performance enhancements, 64-bit machine support, and support for generic programming. You will learn about these and many other features in the upcoming features.