├── Invoking Block Objects ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── main.m │ ├── GCDAppDelegate.h │ └── GCD-Info.plist └── Invoking Block Objects.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Performing UI related Tasks ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ └── GCD-Info.plist └── Performing UI related Tasks.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Different Types of Dispatch Queues ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ ├── GCDAppDelegate.m │ └── GCD-Info.plist └── Different Types of Dispatch Queues.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Performing Tasks After a Delay ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ ├── GCD-Info.plist │ └── GCDAppDelegate.m └── Performing Tasks After a Delay.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Performing a Task At Most Once ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── MySingleton.h │ ├── GCDAppDelegate.h │ ├── main.m │ ├── MySingleton.m │ ├── GCD-Info.plist │ └── GCDAppDelegate.m └── Performing a Task At Most Once.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Running a Group of Tasks Together ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ └── GCD-Info.plist └── Running a Group of Tasks Together.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Block Objects Memory Management ├── iOS │ ├── GCD │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── iPad │ │ │ ├── GCDAppDelegate_iPad.h │ │ │ └── GCDAppDelegate_iPad.m │ │ ├── iPhone │ │ │ ├── GCDAppDelegate_iPhone.h │ │ │ └── GCDAppDelegate_iPhone.m │ │ ├── GCD-Prefix.pch │ │ ├── main.m │ │ ├── GCDAppDelegate.h │ │ ├── GCDAppDelegate.m │ │ └── GCD-Info.plist │ └── Block Objects Memory Management in iOS.xcodeproj │ │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ │ └── xcuserdata │ │ ├── vandad.xcuserdatad │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── GCD.xcscheme │ │ └── BrainyBinary.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme └── Mac OS X │ ├── GCD │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ └── Credits.rtf │ ├── GCD-Prefix.pch │ ├── main.m │ ├── GCDAppDelegate.h │ ├── GCDAppDelegate.m │ └── GCD-Info.plist │ └── Block Objects Memory Management in Mac OS X.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Constructing Your Own Dispatch Queues ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ └── GCD-Info.plist └── Constructing Your Own Dispatch Queues.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Constructing Block Objects and Their Syntax ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ └── GCD-Info.plist └── Constructing Block Objects and Their Syntax.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Dispatching Tasks to Grand Central Dispatch ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ ├── GCDAppDelegate.m │ └── GCD-Info.plist └── Dispatching Tasks to Grand Central Dispatch.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Short Introduction to Grand Central Dispatch ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ ├── GCD-Info.plist │ └── GCDAppDelegate.m └── Short Introduction to Grand Central Dispatch.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Variables and Their Scope in Block Objects ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── main.m │ ├── GCDAppDelegate.h │ └── GCD-Info.plist └── Variables and Their Scope in Block Objects.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ └── GCD.xcscheme ├── Performing non-UI related Tasks Asynchronously ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── RootViewController_iPhone.h │ ├── main.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCDAppDelegate.m │ └── GCD-Info.plist └── Performing non-UI related Tasks Asynchronously.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Performing non-UI related Tasks Synchronously ├── GCD │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iPad │ │ ├── GCDAppDelegate_iPad.h │ │ └── GCDAppDelegate_iPad.m │ ├── iPhone │ │ ├── GCDAppDelegate_iPhone.h │ │ └── GCDAppDelegate_iPhone.m │ ├── GCD-Prefix.pch │ ├── GCDAppDelegate.h │ ├── main.m │ ├── GCD-Info.plist │ └── GCDAppDelegate.m └── Performing non-UI related Tasks Synchronously.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── xcuserdata │ ├── vandad.xcuserdatad │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── GCD.xcscheme │ └── BrainyBinary.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── README /Invoking Block Objects/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Invoking Block Objects/Invoking Block Objects.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Performing UI related Tasks/Performing UI related Tasks.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/Performing Tasks After a Delay.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/Performing a Task At Most Once.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/Running a Group of Tasks Together.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/Different Types of Dispatch Queues.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/Block Objects Memory Management in iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/Constructing Your Own Dispatch Queues.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/Block Objects Memory Management in Mac OS X.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/Constructing Block Objects and Their Syntax.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/Dispatching Tasks to Grand Central Dispatch.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/Variables and Their Scope in Block Objects.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/Performing non-UI related Tasks Synchronously.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/Short Introduction to Grand Central Dispatch.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/Performing non-UI related Tasks Asynchronously.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-09. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This repository contains all example codes from the O'Reilly book "Concurrent Programming in Mac OS X and iOS" by Vandad Nahavandipoor 2 | 3 | You can find the book on O'Reilly: 4 | http://oreilly.com/catalog/0636920020332 5 | 6 | Or on Amazon: 7 | http://www.amazon.com/Concurrent-Programming-Mac-iOS-Performance/dp/1449305636/ref=sr_1_1?ie=UTF8&qid=1308384608&sr=8-1 8 | 9 | Or other major book sellers -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/iPad/GCDAppDelegate_iPad.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPad : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/MySingleton.h: -------------------------------------------------------------------------------- 1 | // 2 | // MySingleton.h 3 | // Performing a Task At Most Once 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-09. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface MySingleton : NSObject { 13 | 14 | } 15 | 16 | + (MySingleton *) sharedInstance; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/iPad/GCDAppDelegate_iPad.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPad.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPad.h" 10 | 11 | @implementation GCDAppDelegate_iPad 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | 11 | @implementation GCDAppDelegate_iPhone 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/GCD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCD' target in the 'GCD' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/RootViewController_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController_iPhone.h 3 | // Performing non-UI related Tasks Asynchronously 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-09. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface RootViewController_iPhone : UIViewController { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-09. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | @private 13 | NSWindow *window; 14 | } 15 | 16 | @property (assign) IBOutlet NSWindow *window; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | @protected 13 | NSString *stringProperty; 14 | } 15 | 16 | @property (nonatomic, retain) NSString *stringProperty; 17 | @property (nonatomic, retain) IBOutlet UIWindow *window; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCDAppDelegate : NSObject { 12 | @protected 13 | NSString *stringProperty; 14 | } 15 | 16 | @property (nonatomic, retain) NSString *stringProperty; 17 | @property (nonatomic, retain) IBOutlet UIWindow *window; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/iPhone/GCDAppDelegate_iPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GCDAppDelegate.h" 11 | 12 | @interface GCDAppDelegate_iPhone : GCDAppDelegate { 13 | @protected 14 | UINavigationController *navigationController; 15 | } 16 | 17 | @property (nonatomic, retain) UINavigationController *navigationController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/GCD/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/GCDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.h 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NSString* (^StringTrimmingBlockObject)(NSString *paramString); 12 | 13 | @interface GCDAppDelegate : NSObject { 14 | @protected 15 | StringTrimmingBlockObject trimmingBlock; 16 | } 17 | 18 | @property (nonatomic, retain) IBOutlet UIWindow *window; 19 | @property (nonatomic, copy) StringTrimmingBlockObject trimmingBlock; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Invoking Block Objects/Invoking Block Objects.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 24 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Invoking Block Objects/Invoking Block Objects.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing UI related Tasks/Performing UI related Tasks.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 21 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/Performing Tasks After a Delay.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 9 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing UI related Tasks/Performing UI related Tasks.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/Performing a Task At Most Once.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 42 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/Performing Tasks After a Delay.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/Performing a Task At Most Once.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/Different Types of Dispatch Queues.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 4 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/Running a Group of Tasks Together.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 22 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/Block Objects Memory Management in iOS.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 30 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/Constructing Your Own Dispatch Queues.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 23 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/Different Types of Dispatch Queues.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/Running a Group of Tasks Together.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/Block Objects Memory Management in iOS.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/Constructing Your Own Dispatch Queues.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/Block Objects Memory Management in Mac OS X.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 10 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 829C6AEF13504C88002FEBDD 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/Variables and Their Scope in Block Objects.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 16 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/Block Objects Memory Management in Mac OS X.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 829C6AEF13504C88002FEBDD 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/Constructing Block Objects and Their Syntax.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 32 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/Dispatching Tasks to Grand Central Dispatch.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 14 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/Performing non-UI related Tasks Synchronously.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 8 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/Short Introduction to Grand Central Dispatch.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 41 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/Variables and Their Scope in Block Objects.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/Constructing Block Objects and Their Syntax.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/Dispatching Tasks to Grand Central Dispatch.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/Performing non-UI related Tasks Asynchronously.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 20 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/Performing non-UI related Tasks Synchronously.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/Short Introduction to Grand Central Dispatch.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/Performing non-UI related Tasks Asynchronously.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GCD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 82B8B56A134C3E4A0069388B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | @synthesize window=_window; 14 | 15 | - (BOOL) application:(UIApplication *)application 16 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 17 | 18 | 19 | 20 | // Override point for customization after application launch. 21 | [self.window makeKeyAndVisible]; 22 | return YES; 23 | } 24 | 25 | 26 | - (void)dealloc 27 | { 28 | [_window release]; 29 | [super dealloc]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | 14 | @synthesize window=_window; 15 | 16 | 17 | - (BOOL) application:(UIApplication *)application 18 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 19 | 20 | dispatch_queue_t mainQueue = dispatch_get_main_queue(); 21 | 22 | // Override point for customization after application launch. 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)dealloc 28 | { 29 | [_window release]; 30 | [super dealloc]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | 14 | @synthesize window=_window; 15 | 16 | void myGCDFunction(void * paramContext){ 17 | 18 | /* Do the work here */ 19 | 20 | } 21 | 22 | - (BOOL) application:(UIApplication *)application 23 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 24 | 25 | dispatch_queue_t mainQueue = dispatch_get_main_queue(); 26 | 27 | dispatch_async_f(mainQueue, 28 | NULL, 29 | myGCDFunction); 30 | 31 | // Override point for customization after application launch. 32 | [self.window makeKeyAndVisible]; 33 | return YES; 34 | } 35 | 36 | - (void)dealloc 37 | { 38 | [_window release]; 39 | [super dealloc]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-09. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | @synthesize window; 14 | 15 | typedef NSString* (^StringTrimmingBlockObject)(NSString *paramString); 16 | 17 | NSString* (^trimString)(NSString *) = ^(NSString *paramString){ 18 | NSString *result = nil; 19 | 20 | result = [paramString 21 | stringByTrimmingCharactersInSet: 22 | [NSCharacterSet whitespaceCharacterSet]]; 23 | 24 | return result; 25 | }; 26 | 27 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 28 | { 29 | 30 | StringTrimmingBlockObject trimmingBlockObject = Block_copy(trimString); 31 | 32 | NSString *trimmedString = trimmingBlockObject(@" O'Reilly "); 33 | 34 | NSLog(@"Trimmed string = %@", trimmedString); 35 | 36 | Block_release(trimmingBlockObject); 37 | 38 | } 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/MySingleton.m: -------------------------------------------------------------------------------- 1 | // 2 | // MySingleton.m 3 | // Performing a Task At Most Once 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-09. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "MySingleton.h" 10 | 11 | @implementation MySingleton 12 | 13 | static MySingleton *sharedMySingleton = NULL; 14 | 15 | + (MySingleton *) sharedInstance{ 16 | 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | if (sharedMySingleton == NULL){ 20 | sharedMySingleton = [[super allocWithZone:NULL] init]; 21 | } 22 | }); 23 | 24 | return sharedMySingleton; 25 | } 26 | 27 | + (id) allocWithZone:(NSZone *)paramZone{ 28 | return [[self sharedInstance] retain]; 29 | 30 | } 31 | 32 | - (id) copyWithZone:(NSZone *)paramZone{ 33 | return self; 34 | } 35 | 36 | - (void) release{ 37 | /* Do nothing */ 38 | } 39 | 40 | - (id) autorelease{ 41 | return self; 42 | } 43 | 44 | - (NSUInteger) retainCount{ 45 | return NSUIntegerMax; 46 | } 47 | 48 | - (id) retain{ 49 | return self; 50 | } 51 | 52 | @end -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | @synthesize window=_window; 14 | @synthesize trimmingBlock; 15 | 16 | NSString* (^trimString)(NSString *) = ^(NSString *paramString){ 17 | NSString *result = nil; 18 | 19 | result = [paramString 20 | stringByTrimmingCharactersInSet: 21 | [NSCharacterSet whitespaceCharacterSet]]; 22 | 23 | return result; 24 | }; 25 | 26 | - (id) autoreleaseTrimStringBlockObject{ 27 | 28 | return [trimString autorelease]; 29 | 30 | } 31 | 32 | - (BOOL) application:(UIApplication *)application 33 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 34 | 35 | self.trimmingBlock = trimString; 36 | 37 | NSString *trimmedString = self.trimmingBlock(@" O'Reilly "); 38 | 39 | NSLog(@"Trimmed string = %@", trimmedString); 40 | 41 | // Override point for customization after application launch. 42 | [self.window makeKeyAndVisible]; 43 | return YES; 44 | } 45 | 46 | - (void)dealloc{ 47 | [trimmingBlock release]; 48 | [_window release]; 49 | [super dealloc]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/iPhone/GCDAppDelegate_iPhone.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate_iPhone.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate_iPhone.h" 10 | #import "RootViewController_iPhone.h" 11 | 12 | @implementation GCDAppDelegate_iPhone 13 | 14 | @synthesize navigationController; 15 | 16 | - (BOOL) application:(UIApplication *)application 17 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 18 | 19 | [super application:application 20 | didFinishLaunchingWithOptions:launchOptions]; 21 | 22 | RootViewController_iPhone *controller = [[RootViewController_iPhone alloc] 23 | initWithNibName:@"RootViewController_iPhone" 24 | bundle:nil]; 25 | 26 | UINavigationController *newNC = [[UINavigationController alloc] initWithRootViewController:controller]; 27 | 28 | [newNC setNavigationBarHidden:YES 29 | animated:NO]; 30 | 31 | navigationController = [newNC retain]; 32 | 33 | [controller release]; 34 | [newNC release]; 35 | 36 | 37 | [[super window] addSubview:navigationController.view]; 38 | 39 | return YES; 40 | } 41 | 42 | - (void)dealloc{ 43 | [navigationController release]; 44 | [super dealloc]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Invoking Block Objects/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Performing UI related Tasks/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Asynchronously/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/GCD-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.pixolity.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow_iPhone 31 | NSMainNibFile~ipad 32 | MainWindow_iPad 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | #import "MySingleton.h" 11 | 12 | @implementation GCDAppDelegate 13 | @synthesize window=_window; 14 | 15 | //static dispatch_once_t onceToken; 16 | // 17 | //void (^executedOnlyOnce)(void) = ^{ 18 | // 19 | // static NSUInteger numberOfEntries = 0; 20 | // numberOfEntries++; 21 | // NSLog(@"Executed %lu time(s)", (unsigned long)numberOfEntries); 22 | // 23 | //}; 24 | // 25 | //- (BOOL) application:(UIApplication *)application 26 | // didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 27 | // 28 | // dispatch_queue_t concurrentQueue = 29 | // dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 30 | // 31 | // dispatch_once(&onceToken, ^{ 32 | // dispatch_async(concurrentQueue, 33 | // executedOnlyOnce); 34 | // }); 35 | // 36 | // dispatch_once(&onceToken, ^{ 37 | // dispatch_async(concurrentQueue, 38 | // executedOnlyOnce); 39 | // }); 40 | // 41 | // // Override point for customization after application launch. 42 | // [self.window makeKeyAndVisible]; 43 | // return YES; 44 | //} 45 | 46 | 47 | 48 | - (BOOL) application:(UIApplication *)application 49 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 50 | 51 | MySingleton *obj1 = [MySingleton sharedInstance]; 52 | MySingleton *obj2 = [MySingleton sharedInstance]; 53 | MySingleton *obj3 = [MySingleton sharedInstance]; 54 | 55 | NSLog(@"Object 1 = %@", obj1); 56 | NSLog(@"Object 2 = %@", obj2); 57 | NSLog(@"Object 3 = %@", obj3); 58 | 59 | // Override point for customization after application launch. 60 | [self.window makeKeyAndVisible]; 61 | return YES; 62 | } 63 | 64 | 65 | - (void)dealloc 66 | { 67 | [_window release]; 68 | [super dealloc]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | @synthesize window=_window; 14 | 15 | //void (^printFrom1To1000)(void) = ^{ 16 | // 17 | // NSUInteger counter = 0; 18 | // for (counter = 1; 19 | // counter <= 1000; 20 | // counter++){ 21 | // 22 | // NSLog(@"Counter = %lu - Thread = %@", 23 | // (unsigned long)counter, 24 | // [NSThread currentThread]); 25 | // 26 | // } 27 | // 28 | //}; 29 | 30 | //- (BOOL) application:(UIApplication *)application 31 | // didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 32 | // 33 | // dispatch_queue_t concurrentQueue = 34 | // dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 35 | // 36 | // dispatch_sync(concurrentQueue, printFrom1To1000); 37 | // dispatch_sync(concurrentQueue, printFrom1To1000); 38 | // 39 | // // Override point for customization after application launch. 40 | // [self.window makeKeyAndVisible]; 41 | // return YES; 42 | //} 43 | 44 | 45 | void printFrom1To1000(void *paramContext){ 46 | 47 | NSUInteger counter = 0; 48 | for (counter = 1; 49 | counter <= 1000; 50 | counter++){ 51 | 52 | NSLog(@"Counter = %lu - Thread = %@", 53 | (unsigned long)counter, 54 | [NSThread currentThread]); 55 | 56 | } 57 | 58 | } 59 | 60 | - (BOOL) application:(UIApplication *)application 61 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 62 | 63 | 64 | dispatch_queue_t concurrentQueue = 65 | dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 66 | 67 | dispatch_sync_f(concurrentQueue, 68 | NULL, 69 | printFrom1To1000); 70 | 71 | dispatch_sync_f(concurrentQueue, 72 | NULL, 73 | printFrom1To1000); 74 | 75 | // Override point for customization after application launch. 76 | [self.window makeKeyAndVisible]; 77 | return YES; 78 | } 79 | 80 | 81 | - (void)dealloc 82 | { 83 | [_window release]; 84 | [super dealloc]; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | @synthesize window=_window; 14 | 15 | //- (void) printString:(NSString *)paramString{ 16 | // 17 | // NSLog(@"%@", paramString); 18 | // 19 | //} 20 | // 21 | //- (BOOL) application:(UIApplication *)application 22 | // didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 23 | // 24 | // @selector(performSelector:withObject:afterDelay:) 25 | // 26 | // [self performSelector:@selector(printString:) 27 | // withObject:@"Grand Central Dispatch" 28 | // afterDelay:3.0]; 29 | // 30 | // // Override point for customization after application launch. 31 | // [self.window makeKeyAndVisible]; 32 | // return YES; 33 | //} 34 | 35 | void processSomething(void *paramContext){ 36 | 37 | /* Do your processing here */ 38 | NSLog(@"Processing..."); 39 | 40 | } 41 | 42 | - (BOOL) application:(UIApplication *)application 43 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 44 | 45 | double delayInSeconds = 2.0; 46 | 47 | dispatch_time_t delayInNanoSeconds = 48 | dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 49 | 50 | dispatch_queue_t concurrentQueue = 51 | dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 52 | 53 | dispatch_after_f(delayInNanoSeconds, 54 | concurrentQueue, 55 | NULL, 56 | processSomething); 57 | 58 | // Override point for customization after application launch. 59 | [self.window makeKeyAndVisible]; 60 | return YES; 61 | } 62 | 63 | //- (BOOL) application:(UIApplication *)application 64 | // didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 65 | // 66 | // double delayInSeconds = 2.0; 67 | // 68 | // dispatch_time_t delayInNanoSeconds = 69 | // dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 70 | // 71 | // dispatch_queue_t concurrentQueue = 72 | // dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 73 | // 74 | // dispatch_after(delayInNanoSeconds, concurrentQueue, ^(void){ 75 | // /* Perform your operations here */ 76 | // }); 77 | // 78 | // // Override point for customization after application launch. 79 | // [self.window makeKeyAndVisible]; 80 | // return YES; 81 | //} 82 | 83 | 84 | - (void)dealloc 85 | { 86 | [_window release]; 87 | [super dealloc]; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/GCD/GCDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCDAppDelegate.m 3 | // GCD 4 | // 5 | // Created by Vandad Nahavandipoor on 11-04-06. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GCDAppDelegate.h" 10 | 11 | @implementation GCDAppDelegate 12 | 13 | 14 | @synthesize window=_window; 15 | 16 | - (void) doCalculation{ 17 | 18 | /* Do your calculation here */ 19 | 20 | } 21 | 22 | //- (void) calculationThreadEntry{ 23 | // 24 | // NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 25 | // 26 | // NSUInteger counter = 0; 27 | // 28 | // while ([[NSThread currentThread] isCancelled] == NO){ 29 | // 30 | // [self doCalculation]; 31 | // 32 | // counter++; 33 | // 34 | // if (counter >= 1000){ 35 | // break; 36 | // } 37 | // 38 | // } 39 | // 40 | // [pool release]; 41 | // 42 | //} 43 | // 44 | //- (BOOL) application:(UIApplication *)application 45 | // didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 46 | // 47 | // /* Start the thread */ 48 | // [NSThread detachNewThreadSelector:@selector(calculationThreadEntry) 49 | // toTarget:self 50 | // withObject:nil]; 51 | // 52 | // // Override point for customization after application launch. 53 | // [self.window makeKeyAndVisible]; 54 | // return YES; 55 | //} 56 | 57 | 58 | - (BOOL) application:(UIApplication *)application 59 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 60 | 61 | 62 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 63 | 64 | dispatch_async(queue, ^(void) { 65 | NSUInteger counter = 0; 66 | for (counter = 0; 67 | counter < 1000; 68 | counter++){ 69 | 70 | NSLog(@"Block 1 - Iteration: %lu - Thread: %@", (unsigned long)counter, [NSThread currentThread]); 71 | 72 | } 73 | }); 74 | 75 | dispatch_async(queue, ^(void) { 76 | NSUInteger counter = 0; 77 | for (counter = 0; 78 | counter < 1000; 79 | counter++){ 80 | 81 | NSLog(@"Block 2 - Iteration: %lu - Thread: %@", (unsigned long)counter, [NSThread currentThread]); 82 | 83 | } 84 | }); 85 | 86 | // dispatch_queue_t queue = 87 | // dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 88 | // 89 | // /* You can change this number */ 90 | // size_t numberOfIterations = 1000; 91 | // 92 | // dispatch_async(queue, ^(void) { 93 | // dispatch_apply(numberOfIterations, queue, ^(size_t iteration){ 94 | // /* Perform the operation here */ 95 | // }); 96 | // }); 97 | 98 | 99 | // Override point for customization after application launch. 100 | [self.window makeKeyAndVisible]; 101 | return YES; 102 | } 103 | 104 | - (void)dealloc 105 | { 106 | [_window release]; 107 | [super dealloc]; 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /Invoking Block Objects/Invoking Block Objects.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Invoking Block Objects/Invoking Block Objects.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Performing UI related Tasks/Performing UI related Tasks.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Performing UI related Tasks/Performing UI related Tasks.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/Performing Tasks After a Delay.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/Performing a Task At Most Once.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Performing Tasks After a Delay/Performing Tasks After a Delay.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Performing a Task At Most Once/Performing a Task At Most Once.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/Running a Group of Tasks Together.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/Different Types of Dispatch Queues.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Running a Group of Tasks Together/Running a Group of Tasks Together.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Different Types of Dispatch Queues/Different Types of Dispatch Queues.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/Block Objects Memory Management in iOS.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/Constructing Your Own Dispatch Queues.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Constructing Your Own Dispatch Queues/Constructing Your Own Dispatch Queues.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Block Objects Memory Management/iOS/Block Objects Memory Management in iOS.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/Block Objects Memory Management in Mac OS X.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/Variables and Their Scope in Block Objects.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/Constructing Block Objects and Their Syntax.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/Dispatching Tasks to Grand Central Dispatch.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Variables and Their Scope in Block Objects/Variables and Their Scope in Block Objects.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Block Objects Memory Management/Mac OS X/Block Objects Memory Management in Mac OS X.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Constructing Block Objects and Their Syntax/Constructing Block Objects and Their Syntax.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Dispatching Tasks to Grand Central Dispatch/Dispatching Tasks to Grand Central Dispatch.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/Short Introduction to Grand Central Dispatch.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Performing non-UI related Tasks Synchronously/Performing non-UI related Tasks Synchronously.xcodeproj/xcuserdata/vandad.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Short Introduction to Grand Central Dispatch/Short Introduction to Grand Central Dispatch.xcodeproj/xcuserdata/BrainyBinary.xcuserdatad/xcschemes/GCD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | --------------------------------------------------------------------------------