HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Use Xcode 5 to Write Great iOS and OS X Apps!
Xcode 5 Start to Finish will help you use the tools in Apple’s Xcode 5 to improve productivity, write great code, and leverage the newest iOS 7 and OS X Mavericks features.
Drawing on thirty years of experience developing for Apple platforms and helping others do so, Fritz Anderson shows you a complete best-practice Xcode workflow. Through three full sample projects, you’ll learn to integrate testing, source control, and other key skills into a high-efficiency process that works.
Anderson shows you better ways to storyboard, instrument, build, and compile code, and helps you apply innovations ranging from Quick Look to Preview Assistant. By the time you’re finished, you’ll have the advanced Xcode skills to develop outstanding software.
Coverage includes
Register your book at www.informit.com/register for access to this title’s downloadable code.
Detached Retinas: How to Develop and Test OS X Retina Apps on Non-Retina MacBook Pros
Download the sample pages (includes Chapter 2 and Index)
Acknowledgments xxiii
About the Author xxv
Introduction 1
How This Book Is Organized 1
About Versions 4
About the Code 4
Conventions 5
Part I: First Steps 7
Chapter 1: Getting Xcode 9
Before You Begin 9
Installing Xcode 10
Removing Xcode 11
Apple Developer Programs 12
Downloading Xcode 13
Additional Downloads 14
Summary 15
Chapter 2: Kicking the Tires 17
Starting Xcode 17
Hello World 18
Getting Rid of It 24
Summary 24
Chapter 3: Simple Workflow and Passive Debugging 25
Creating the Project 25
Building 29
Running 31
Simple Debugging 32
Summary 34
Chapter 4: Active Debugging 35
A Simple Test Case 35
Going Active 35
Fixing the Problem 39
Summary 43
Chapter 5: Compilation 45
Compiling 45
Linking 50
Dynamic Loading 52
Xcode and Clang 53
Compiler Products 58
Summary 62
Chapter 6: Adding a Library Target 63
Adding a Target 63
Target Membership 65
A Dependent Target 68
Summary 70
Chapter 7: Version Control 73
Taking Control 74
The State of Your Files 76
Your First Commit 78
Working with Remote Repositories 79
Merges and Conflicts 83
The Version Editor 93
Branching 96
Summary 98
Part II: The Life Cycle of an iOS Application 101
Chapter 8: Starting an iOS Application 103
Planning the App 103
Starting a New iOS Project 106
What’s in the Project 108
One More Thing 110
Summary 112
Chapter 9: An iOS Application: Model 113
Implementing the Model 113
Managed-Object Classes 120
Making the Model Easier to Debug 131
Summary 132
Chapter 10: An iOS Application: Controller 133
Renaming Symbols 133
Editing the View Controller 136
Live Issues and Fix-it 138
The Real Passer Rating 140
Summary 145
Chapter 11: Building a New View 147
The Next View Controller 147
Building a View 152
The Table View 161
Outlets 161
Testing the Billboard View 170
Summary 171
Chapter 12: Autolayout in a New View 173
Why Autolayout? 173
The Player Billboard, Revisited 175
The Label System 179
Summary 185
Chapter 13: Adding Table Cells 187
The Game Table 187
The Game Table: First Run 191
A Custom Table Cell 193
Adding Some Graphics 196
Summary 202
Chapter 14: Adding an Editor 205
The Plan 205
Adding a Modal Scene 205
The Editor View Controllers 210
Segues 218
Summary 219
Chapter 15: Unit Testing 221
The Test Navigator 222
Testing the CSV Reader 224
Testing and the Debugger 229
Application Tests 232
TestKit Assertions 233
Summary 236
Chapter 16: Measurement and Analysis 237
Speed 237
Memory 247
Summary 253
Chapter 17: Provisioning 255
Apple Developer Programs 255
Provisioning for iOS 257
The Capabilities Editor 262
OS X Sandboxing 264
Gatekeeper and Developer ID 266
Distribution Builds 269
Summary 273
Part III: Xcode for Mac OS X 275
Chapter 18: Starting an OS X Application 277
The Goal 277
Getting Started 278
Model 281
Wiring a Menu 287
Summary 293
Chapter 19: Bindings: Wiring an OS X Application 295
Laying Out the Document Window 295
Filling the Table— Bindings 301
Layering NSControllers 307
Running a Popover with Bindings 315
Running the Near-Final App 321
Summary 322
Chapter 20: A Custom View for OS X 323
A Graphing View 325
Back to the View Controller 328
QuickLook in the Debugger 332
Custom View Properties 334
Summary 336
Chapter 21: Localization 337
How Localization Works 337
Adding a Localization 338
Localizing MainMenu.xib 347
Localizing Info.plist 353
Strings in Code 355
Showing Mac Passer Rating in Finder 359
Summary 364
Chapter 22: Bundles and Packages 365
A Simple Package: RTFD 365
Bundles 367
Application Bundles 367
The Info.plist File 369
Info.plist Keys for Applications 371
Info.plist 379
Summary 379
Chapter 23: Frameworks 381
Adding a Framework Target 381
Installing a Framework 383
Building Mac Passer Rating 387
Debugging a Framework 388
Summary 394
Chapter 24: Property Lists 395
Property List Data Types 395
Editing Property Lists 396
Other Formats 406
Specialized Property Lists 407
Summary 408
Part IV: Xcode Tasks 409
Chapter 25: Documentation in Xcode 411
Quick Help 411
Open Quickly 413
Help 414
The Documentation Window 415
Keeping Current 419
Your Own Quick Help 421
Your Own Docsets 424
Summary 430
Chapter 26: The Xcode Build System 431
How Xcode Structures a Build 431
Build Variables 434
Settings Hierarchy 435
Editing Build Variables 437
Configurations 438
Configuration Files 439
Command-Line Tools 443
Custom Build Rules 446
The Build Log 448
A Simple Build Transcript 450
Summary 458
Chapter 27: Instruments 459
What Instruments Is 459
Running Instruments 460
The Instruments 474
Custom Instruments 480
The Templates 482
Summary 484
Chapter 28: Debugging 485
Scheme Options 485
Doing More with Breakpoints 488
The lldb Command Line 491
Tips 493
Summary 497
Chapter 29: Continuous Integration 499
Xcode Server 500
Bots 503
Seeing the Results 507
Building for Distribution 508
Summary 509
Chapter 30: Snippets 511
Tricks 511
Traps 522
Part V: Appendixes 525
Appendix A: Some Build Variables 527
Useful Build Variables 528
Environment 528
Code Signing 529
Locations 530
Compiler Settings 533
Search Paths 535
Info.plist 535
The DEVELOPER Variables 536
Source Trees 537
Appendix B: Resources 539
Books 539
On the Net 540
Face to Face 544
Other Software 544
Index 555