Objective-C Programming Nuts and bolts
By Keith Lee
()
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
Swift Programming Nuts and bolts Rating: 0 out of 5 stars0 ratingsProgramming for Everyone Rating: 3 out of 5 stars3/5Core Objective-C in 24 Hours Rating: 5 out of 5 stars5/5iOS Programming Nuts and bolts Rating: 4 out of 5 stars4/5
Related to Objective-C Programming Nuts and bolts
Related ebooks
Design Patterns in C#: A Hands-on Guide with Real-world Examples Rating: 0 out of 5 stars0 ratingsTest-Driven iOS Development with Swift Rating: 5 out of 5 stars5/5Swift in 30 Days: Build iOS Apps by Learning Swift, Xcode, and SwiftUI in Just Four Weeks (English Edition) Rating: 0 out of 5 stars0 ratingsSwift 3 Object-Oriented Programming - Second Edition Rating: 0 out of 5 stars0 ratingsiOS 15 Application Development for Beginners: Learn Swift Programming and Build iPhone Apps with SwiftUI and Xcode 13 Rating: 0 out of 5 stars0 ratingsC# Programming Illustrated Guide For Beginners & Intermediates: The Future Is Here! Learning By Doing Approach Rating: 0 out of 5 stars0 ratingsASP.NET Core for Jobseekers: Build Career in Designing Cross-Platform Web Applications Using Razor and Entity Framework Core Rating: 0 out of 5 stars0 ratingsMastering C# Concurrency Rating: 0 out of 5 stars0 ratingsHow To Program A Mobile Game Rating: 4 out of 5 stars4/5Application Development with Swift Rating: 0 out of 5 stars0 ratingsObjective-C Fundamentals Rating: 0 out of 5 stars0 ratingsBeginning C++ Game Programming - Second Edition: Learn to program with C++ by building fun games, 2nd Edition Rating: 0 out of 5 stars0 ratingsMetaprogramming in .NET Rating: 5 out of 5 stars5/5Swift Functional Programming - Second Edition Rating: 3 out of 5 stars3/5Multithreading in C# 5.0 Cookbook Rating: 0 out of 5 stars0 ratingsSwift Essentials - Second Edition Rating: 0 out of 5 stars0 ratingsLearn Multithreading with Modern C++ Rating: 0 out of 5 stars0 ratingsLearning Swift Rating: 5 out of 5 stars5/5Swift in Depth Rating: 0 out of 5 stars0 ratingsBoost.Asio C++ Network Programming - Second Edition Rating: 0 out of 5 stars0 ratingsiOS 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/5C# Programming Cookbook Rating: 0 out of 5 stars0 ratingsJavaScript: Best Practices to Programming Code with JavaScript: JavaScript Computer Programming, #3 Rating: 0 out of 5 stars0 ratingsFunctional Programming in C#: How to write better C# code Rating: 5 out of 5 stars5/5iOS 13 Programming for Beginners - Fourth Edition: Get started with building iOS apps with Swift 5 and Xcode 11, 4th Edition 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 ratingsScala Functional Programming Patterns Rating: 0 out of 5 stars0 ratingsDart Cookbook Rating: 0 out of 5 stars0 ratings
Programming For You
Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week 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/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Game Development with Unreal Engine 5: Learn the Basics of Game Development in Unreal Engine 5 (English Edition) Rating: 0 out of 5 stars0 ratingsHTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Modern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratingsThe Unofficial Guide to Open Broadcaster Software: OBS: The World's Most Popular Free Live-Streaming Application Rating: 0 out of 5 stars0 ratingsCoding All-in-One For Dummies Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Grokking Algorithms: An illustrated guide for programmers and other curious people 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/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsLearn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsLinux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Web Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/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.