Apress Access

Pro Objective-C Design Patterns for iOS

By Carlo Chung

  • eBook Price: $34.99
Buy eBook Buy Print Book
Some things never go out of style. With this book, learn how to apply classic design patterns to iOS app development using Objective-C.

Full Description

  • Add to Wishlist
  • ISBN13: 978-1-4302-3330-5
  • 392 Pages
  • User Level: Intermediate to Advanced
  • Publication Date: March 31, 2011
  • Available eBook Formats: EPUB, MOBI, PDF

Related Titles

  • Beginning Xcode: Swift 3 Edition
  • Practical Swift
  • Migrating to Swift from Flash and ActionScript
  • Agile Swift
Full Description

It’s time to capitalize on your mastery of Cocoa with Pro Objective-C Design Patterns for iOS. You’ve developed apps that impressed and performed, and now you’re ready to jump into development practices that will leave you with more effective, efficient, and professional level apps. This book is the element you need to make the jump from journeyman to master.

All too often, developers grind through building good apps on willpower and a vigorous focus on code development, leaving them unaware of and unable to benefit from the underlying structural and functional design patterns.

Pro Objective-C Design Patterns for iOS will teach you those design patterns that have always been present at some level in your code, but were never recognized, acknowledged, or fully utilized. Implementation of specific pattern approaches will prove their value to any developer working in the iOS application arena. You’ll learn to master classic patterns like singleton, abstract factory, chain of responsibility, and observer. You’ll also discover less well-known but useful patterns like memento, composite, command, and mediator.

What you’ll learn

  • The basic concepts of various design patterns
  • How to apply design patterns to your code based on different scenarios
  • How design patterns can strengthen your apps

Who this book is for

Any professional or aspiring iOS developer will find productivity, efficiency, and effectiveness of software development enhanced by the methods and practice delivered by Pro Objective-C Design Patterns for iOS.

Table of Contents

Table of Contents

  1. Hello, Design Patterns!
  2. A Case Study: Designing an App
  3. Prototype
  4. Factory Method
  5. Abstract Factory
  6. Builder
  7. Singleton
  8. Adapter
  9. Bridge
  10. Fa├žade
  11. Mediator
  12. Observer
  13. Composite
  14. Iterator
  15. Visitor
  16. Decorator
  17. Chain of Responsibility
  18. Template Method
  19. Strategy
  20. Command
  21. Flyweight
  22. Proxy
  23. Memento
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.


If you think that you've found an error in this book, please let us know by emailing to editorial@apress.com . You will find any confirmed erratum below, so you can check if your concern has already been addressed.

On page 60:

In the code that follows "// copy the children", child is added to strokeCopy instead of childCopy. Don't you want to add the copy of child, not child itself?

In the third paragraph of text, it states "Vertex is a direct subclass of Dot." Isn't it the other way around?

On page 216:
Listing 14-8 for file Mark.h includes definition for method enumerateMarksUsingBlock:. Listing 14-9 is described as containing the implementation for enumerateMarksUsingBlock, but lists the source file as Stroke.m. I think it should be Mark.m.

On page 239 (Kindle):
That is 239ish of 500 in the Kindle version. No idea what the actual page number is.

This is actually addressing a leak in the code. When you launch a scribble from the thumbnail you get.

2011-07-25 00:58:03.048 TouchPainter[39826:207] An instance 0x5a0bfb0 of class Scribble was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x5a3cad0> (
<NSKeyValueObservance 0x5a3c9d0: Observer: 0x5d168c0, Key path: mark, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x5a033f0>

I think this problem can fix fixed by adding [scribble_ removeObserver:self forKeyPath:@"mark"]; in the setScribble method in CanvasViewController.

- (void) setScribble:(Scribble *)aScribble
if (scribble_ != aScribble)
[scribble_ autorelease];
[scribble_ removeObserver:self forKeyPath:@"mark"];

scribble_ = [aScribble retain];

// add itself to the scribble as
// an observer for any changes to
// its internal state - mark
[scribble_ addObserver:self
options:NSKeyValueObservingOptionInitial |


    1. Pro XAML with C#


      View Book

    2. Software Engineering


      View Book

    3. Software Development and Professional Practice


      View Book