beginning xcode - link.springer.com

21
Beginning Xcode Matthew Knott

Upload: others

Post on 02-Oct-2021

12 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Beginning Xcode - link.springer.com

Beginning Xcode

Matthew Knott

Page 2: Beginning Xcode - link.springer.com

Beginning Xcode

Copyright © 2014 by Matthew Knott

This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law.

ISBN-13 (pbk): 978-1-4302-5743-1

ISBN-13 (electronic): 978-1-4302-5744-8

Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.

The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.

While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.

President and Publisher: Paul ManningLead Editor: Steve AnglinDevelopment Editor: Douglas PundickTechnical Reviewer: Felipe Laso MarsettiEditorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Louise Corrigan,

James T. DeWolf, Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, James Markham, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Gwenan Spearing, Matt Wade, Steve Weiss

Coordinating Editor: Anamika Panchoo, Mark PowersCopy Editor: Mary BeardenCompositor: SPi GlobalIndexer: SPi GlobalArtist: SPi GlobalCover Designer: Anna Ishchenko

Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

For information on translations, please e-mail [email protected], or visit www.apress.com.

Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.

Any source code or other supplementary materials referenced by the author in this text is available to readers at www.apress.com. For detailed information about how to locate your book’s source code, go to www.apress.com/source-code/.

Page 3: Beginning Xcode - link.springer.com

To my wife, Lisa. You’re a rock, an inspiration, and the clockwork that makes this family tick.

Page 4: Beginning Xcode - link.springer.com
Page 5: Beginning Xcode - link.springer.com

v

Contents at a Glance

About the Author ���������������������������������������������������������������������������������������������������������������� xv

About the Technical Reviewer ������������������������������������������������������������������������������������������ xvii

Acknowledgments ������������������������������������������������������������������������������������������������������������� xix

Introduction ����������������������������������������������������������������������������������������������������������������������� xxi

Part 1: Getting Acquainted ■ ��������������������������������������������������������������������������� 1

Chapter 1: Welcome to Xcode ■ ��������������������������������������������������������������������������������������������3

Chapter 2: Diving Right In ■ �����������������������������������������������������������������������������������������������17

Chapter 3: Project Templates and Getting Around ■ �����������������������������������������������������������39

Chapter 4: Building Interfaces ■ �����������������������������������������������������������������������������������������73

Chapter 5: Getting Help and Code Completion ■ ���������������������������������������������������������������113

Chapter 6: Constraints ■ ���������������������������������������������������������������������������������������������������137

Part 2: Diving Deeper ■ �������������������������������������������������������������������������������� 169

Chapter 7: Storyboards ■ ��������������������������������������������������������������������������������������������������171

Chapter 8: Table and Collection Views ■ ��������������������������������������������������������������������������213

Chapter 9: Frameworks, Libraries, and Targ ets ■ ������������������������������������������������������������277

Page 6: Beginning Xcode - link.springer.com

vi Contents at a Glance

Chapter 10: Advanced Editing ■ ���������������������������������������������������������������������������������������313

Chapter 11: Debugging and Analysis ■ ����������������������������������������������������������������������������341

Part 3: Final Preparations and Releasing ■ ������������������������������������������������� 369

Chapter 12: Version Control with Git ■ �����������������������������������������������������������������������������371

Chapter 13: Localization ■ ������������������������������������������������������������������������������������������������405

Chapter 14: The Organizer ■ ���������������������������������������������������������������������������������������������445

Chapter 15: Building, Sharing, and Distributing Applications ■ ���������������������������������������479

Index ���������������������������������������������������������������������������������������������������������������������������������517

Page 7: Beginning Xcode - link.springer.com

vii

Contents

About the Author ���������������������������������������������������������������������������������������������������������������� xv

About the Technical Reviewer ������������������������������������������������������������������������������������������ xvii

Acknowledgments ������������������������������������������������������������������������������������������������������������� xix

Introduction ����������������������������������������������������������������������������������������������������������������������� xxi

Part 1: Getting Acquainted ■ ��������������������������������������������������������������������������� 1

Chapter 1: Welcome to Xcode ■ ��������������������������������������������������������������������������������������������3

What Is Xcode? ������������������������������������������������������������������������������������������������������������������������������3

Why Choose Xcode? ����������������������������������������������������������������������������������������������������������������������4

Prior Assumptions �������������������������������������������������������������������������������������������������������������������������4

What’s Covered in This Book ���������������������������������������������������������������������������������������������������������5

Part 1: Getting Acquainted ������������������������������������������������������������������������������������������������������������������������������������� 5

Part 2: Diving Deeper ��������������������������������������������������������������������������������������������������������������������������������������������� 5

Part 3: Final Preparations and Releasing ��������������������������������������������������������������������������������������������������������������� 6

Getting and Installing Xcode����������������������������������������������������������������������������������������������������������6

Firing Up Xcode �����������������������������������������������������������������������������������������������������������������������������9

Apple’s Resources for Developers �����������������������������������������������������������������������������������������������10

Page 8: Beginning Xcode - link.springer.com

viii Contents

The Dev Center ����������������������������������������������������������������������������������������������������������������������������12

Your Developer Account ��������������������������������������������������������������������������������������������������������������13

Additional Resources �������������������������������������������������������������������������������������������������������������������15

Summary �������������������������������������������������������������������������������������������������������������������������������������16

Chapter 2: Diving Right In ■ �����������������������������������������������������������������������������������������������17

Creating Your First Xcode Project ������������������������������������������������������������������������������������������������18

The Project ����������������������������������������������������������������������������������������������������������������������������������22

Designing the Interface ���������������������������������������������������������������������������������������������������������������24

Making Connections ��������������������������������������������������������������������������������������������������������������������27

Running and Testing ��������������������������������������������������������������������������������������������������������������������30

Adding Files ���������������������������������������������������������������������������������������������������������������������������������32

Summary �������������������������������������������������������������������������������������������������������������������������������������37

Chapter 3: Project Templates and Getting Around ■ �����������������������������������������������������������39

Project Templates ������������������������������������������������������������������������������������������������������������������������40

Master Detail View ����������������������������������������������������������������������������������������������������������������������������������������������� 41

OpenGL Game ������������������������������������������������������������������������������������������������������������������������������������������������������ 42

Page-Based Application ��������������������������������������������������������������������������������������������������������������������������������������� 43

Single View Application ��������������������������������������������������������������������������������������������������������������������������������������� 44

Tabbed Application ���������������������������������������������������������������������������������������������������������������������������������������������� 45

Utility Application ������������������������������������������������������������������������������������������������������������������������������������������������� 46

Empty Application ������������������������������������������������������������������������������������������������������������������������������������������������ 47

SpriteKit Game ����������������������������������������������������������������������������������������������������������������������������������������������������� 48

Template Selection ���������������������������������������������������������������������������������������������������������������������������������������������� 49

Getting Around �����������������������������������������������������������������������������������������������������������������������������51

Navigators ����������������������������������������������������������������������������������������������������������������������������������������������������������� 51

Toolbar ����������������������������������������������������������������������������������������������������������������������������������������������������������������� 53

Editor ������������������������������������������������������������������������������������������������������������������������������������������������������������������� 54

Utilities ����������������������������������������������������������������������������������������������������������������������������������������������������������������� 57

Page 9: Beginning Xcode - link.springer.com

ixContents

Configuring the Application Delegate ������������������������������������������������������������������������������������������������������������������ 64

Adding a Second View Controller ������������������������������������������������������������������������������������������������������������������������ 67

Debugging Area ��������������������������������������������������������������������������������������������������������������������������������������������������� 71

Summary �������������������������������������������������������������������������������������������������������������������������������������72

Chapter 4: Building Interfaces ■ �����������������������������������������������������������������������������������������73

Getting Ready ������������������������������������������������������������������������������������������������������������������������������74

Before You Start � � � ���������������������������������������������������������������������������������������������������������������������81

Building the Interface ������������������������������������������������������������������������������������������������������������������82

Setting the Tab Icons ������������������������������������������������������������������������������������������������������������������������������������������� 85

Tracking Location with the Track It Tab ��������������������������������������������������������������������������������������������������������������� 87

Mixing Colors with the Slide It Tab ���������������������������������������������������������������������������������������������������������������������� 96

Adding “Off the Menu” Controls ������������������������������������������������������������������������������������������������������������������������ 102

Changing the Interface with Code ��������������������������������������������������������������������������������������������������������������������� 108

Summary �����������������������������������������������������������������������������������������������������������������������������������111

Chapter 5: Getting Help and Code Completion ■ ���������������������������������������������������������������113

Getting Help �������������������������������������������������������������������������������������������������������������������������������114

Creating the Project ������������������������������������������������������������������������������������������������������������������������������������������� 114

Downloading Additional Documentation ������������������������������������������������������������������������������������������������������������ 115

Quick Help ��������������������������������������������������������������������������������������������������������������������������������������������������������� 115

Documentation Viewer vs� Documentation Organizer ��������������������������������������������������������������������������������������� 118

Apple’s Web Site ������������������������������������������������������������������������������������������������������������������������126

Code Completion �����������������������������������������������������������������������������������������������������������������������127

The Header File �������������������������������������������������������������������������������������������������������������������������������������������������� 127

The Implementation File ������������������������������������������������������������������������������������������������������������������������������������ 129

Building the Interface ���������������������������������������������������������������������������������������������������������������������������������������� 131

Summary �����������������������������������������������������������������������������������������������������������������������������������135

Page 10: Beginning Xcode - link.springer.com

x Contents

Chapter 6: Constraints ■ ���������������������������������������������������������������������������������������������������137

Understanding Auto Layout �������������������������������������������������������������������������������������������������������137

Building an Authentication View ������������������������������������������������������������������������������������������������138

Design Considerations ��������������������������������������������������������������������������������������������������������������������������������������� 139

Manually Adding Constraints ����������������������������������������������������������������������������������������������������������������������������� 145

Automatically Adding Constraints ���������������������������������������������������������������������������������������������������������������������� 151

Previewing Your Layout �������������������������������������������������������������������������������������������������������������155

Preview Using Interface Builder ������������������������������������������������������������������������������������������������������������������������ 155

Preview Using the Preview Tool ������������������������������������������������������������������������������������������������������������������������� 157

Finishing Touches ����������������������������������������������������������������������������������������������������������������������159

Customizing Text Fields ������������������������������������������������������������������������������������������������������������������������������������� 160

Summary �����������������������������������������������������������������������������������������������������������������������������������167

Part 2: Diving Deeper ■ �������������������������������������������������������������������������������� 169

Chapter 7: Storyboards ■ ��������������������������������������������������������������������������������������������������171

A Brief History of Storyboards ���������������������������������������������������������������������������������������������������172

Creating a New Project Called SocialApp ����������������������������������������������������������������������������������174

Creating View Controllers ���������������������������������������������������������������������������������������������������������������������������������� 178

Pairing the View to the Controller ���������������������������������������������������������������������������������������������������������������������� 187

Building up the Storyboard ��������������������������������������������������������������������������������������������������������189

Linking Scenes and Building Interfaces ������������������������������������������������������������������������������������192

What Are Segues? ��������������������������������������������������������������������������������������������������������������������������������������������� 193

Adding a Navigation Controller �������������������������������������������������������������������������������������������������������������������������� 197

Creating an Interface for Feed View Controller �������������������������������������������������������������������������������������������������� 200

Creating an Interface for Tweet View Controller ������������������������������������������������������������������������������������������������ 205

Creating an Interface for Compose View Controller ������������������������������������������������������������������������������������������� 209

Summary �����������������������������������������������������������������������������������������������������������������������������������211

Chapter 8: Table and Collection Views ■ ��������������������������������������������������������������������������213

What Is a Table View? ����������������������������������������������������������������������������������������������������������������214

Table View Composition ������������������������������������������������������������������������������������������������������������������������������������� 214

Table View Styles ����������������������������������������������������������������������������������������������������������������������������������������������� 215

Page 11: Beginning Xcode - link.springer.com

xiContents

Configuring the Accounts View ��������������������������������������������������������������������������������������������������216

The Key Attributes of Table Views ���������������������������������������������������������������������������������������������������������������������� 217

Manipulating Static Table Views ������������������������������������������������������������������������������������������������������������������������ 219

The Accounts and Social Framework ���������������������������������������������������������������������������������������������������������������� 222

Retrieving and Displaying Twitter Accounts ������������������������������������������������������������������������������������������������������ 224

Configuring the Feed View ��������������������������������������������������������������������������������������������������������235

Configuring the Tweet View �������������������������������������������������������������������������������������������������������250

Configuring the Compose View �������������������������������������������������������������������������������������������������253

Discovering the Collection View ������������������������������������������������������������������������������������������������258

Embedding a Tab Bar Controller ������������������������������������������������������������������������������������������������������������������������ 258

Persisting User Preferences with NSUserDefaults �������������������������������������������������������������������������������������������� 260

Adding a Collection View Controller ������������������������������������������������������������������������������������������264

Configuring a Collection View ���������������������������������������������������������������������������������������������������������������������������� 268

Displaying Items in a Collection View ���������������������������������������������������������������������������������������������������������������� 270

Summary �����������������������������������������������������������������������������������������������������������������������������������276

Chapter 9: Frameworks, Libraries, and Targets ■ �������������������������������������������������������������277

Understanding Frameworks ������������������������������������������������������������������������������������������������������278

Creating the Project ������������������������������������������������������������������������������������������������������������������������������������������� 279

Static Libraries ��������������������������������������������������������������������������������������������������������������������������291

Creating a Static Library ������������������������������������������������������������������������������������������������������������������������������������ 291

Adding a Static Library to a Project ������������������������������������������������������������������������������������������������������������������� 300

Working with Multiple Targets ���������������������������������������������������������������������������������������������������304

Discovering Modules �����������������������������������������������������������������������������������������������������������������310

Enabling Modules for Older Projects ����������������������������������������������������������������������������������������������������������������� 311

Summary �����������������������������������������������������������������������������������������������������������������������������������311

Chapter 10: Advanced Editing ■ ���������������������������������������������������������������������������������������313

Getting Started ��������������������������������������������������������������������������������������������������������������������������313

Efficient Editing �������������������������������������������������������������������������������������������������������������������������317

Changing Color Schemes����������������������������������������������������������������������������������������������������������������������������������� 317

Organizing and Navigating Code ����������������������������������������������������������������������������������������������������������������������� 322

Page 12: Beginning Xcode - link.springer.com

xii Contents

Building the Scene ��������������������������������������������������������������������������������������������������������������������������������������������� 326

Folding Code ������������������������������������������������������������������������������������������������������������������������������������������������������ 331

The Code Snippet Library ���������������������������������������������������������������������������������������������������������������������������������� 334

Summary �����������������������������������������������������������������������������������������������������������������������������������339

Chapter 11: Debugging and Analysis ■ ����������������������������������������������������������������������������341

Building the Application ������������������������������������������������������������������������������������������������������������342

Using Breakpoints to Resolve Logical Errors�����������������������������������������������������������������������������348

Setting a Breakpoint ������������������������������������������������������������������������������������������������������������������������������������������ 349

The Debug Navigator ����������������������������������������������������������������������������������������������������������������������������������������� 350

The Debug Area ������������������������������������������������������������������������������������������������������������������������������������������������� 351

The Breakpoint Navigator ���������������������������������������������������������������������������������������������������������������������������������� 352

Runtime Errors ��������������������������������������������������������������������������������������������������������������������������356

Using Exception Breakpoints ����������������������������������������������������������������������������������������������������������������������������� 357

Compile-Time Errors �����������������������������������������������������������������������������������������������������������������360

The Issue Navigator ������������������������������������������������������������������������������������������������������������������������������������������� 361

Tools to Help with Debugging ����������������������������������������������������������������������������������������������������362

Debugging Location ������������������������������������������������������������������������������������������������������������������������������������������� 363

Print Debugging with the Printer Simulator ������������������������������������������������������������������������������������������������������� 364

Summary �����������������������������������������������������������������������������������������������������������������������������������367

Part 3: Final Preparations and Releasing ■ ������������������������������������������������� 369

Chapter 12: Version Control with Git ■ �����������������������������������������������������������������������������371

Why Use Version Control? ���������������������������������������������������������������������������������������������������������371

What Is Git? ������������������������������������������������������������������������������������������������������������������������������������������������������� 372

Creating the Project �������������������������������������������������������������������������������������������������������������������373

The AVFoundation Framework ��������������������������������������������������������������������������������������������������������������������������� 375

Creating the Interface ���������������������������������������������������������������������������������������������������������������������������������������� 376

Committing Changes �����������������������������������������������������������������������������������������������������������������383

Examining Changes with the Version Editor ������������������������������������������������������������������������������������������������������ 385

Page 13: Beginning Xcode - link.springer.com

xiiiContents

Branching Within a Repository ��������������������������������������������������������������������������������������������������390

Merging Branches ��������������������������������������������������������������������������������������������������������������������������������������������� 392

Removing a Branch ������������������������������������������������������������������������������������������������������������������������������������������� 395

Using a Remote Repository �������������������������������������������������������������������������������������������������������396

Registering for GitHub and Creating a Repository ��������������������������������������������������������������������������������������������� 396

Adding a GitHub Repository to Xcode ���������������������������������������������������������������������������������������������������������������� 398

Pushing to a Remote Repository ����������������������������������������������������������������������������������������������������������������������� 400

Updating the Remote Repository ����������������������������������������������������������������������������������������������������������������������� 402

Summary �����������������������������������������������������������������������������������������������������������������������������������403

Chapter 13: Localization ■ ������������������������������������������������������������������������������������������������405

Creating the Castles Application �����������������������������������������������������������������������������������������������406

Adding the Resources ���������������������������������������������������������������������������������������������������������������������������������������� 408

Creating the Application Interface ��������������������������������������������������������������������������������������������������������������������� 410

Writing the Code for the Castles Application ����������������������������������������������������������������������������������������������������� 420

Localizing the Application ���������������������������������������������������������������������������������������������������������426

Enabling Localization ����������������������������������������������������������������������������������������������������������������������������������������� 427

Adding Another Language ��������������������������������������������������������������������������������������������������������������������������������� 428

Storyboards and Localization ���������������������������������������������������������������������������������������������������������������������������� 430

Localizing Code with Localizable�strings ����������������������������������������������������������������������������������������������������������� 439

Summary �����������������������������������������������������������������������������������������������������������������������������������443

Chapter 14: The Organizer ■ ���������������������������������������������������������������������������������������������445

What Is the Organizer? ��������������������������������������������������������������������������������������������������������������445

Preparing Xcode for Deploying to a Device �������������������������������������������������������������������������������447

Enrolling in the iOS Developer Program ������������������������������������������������������������������������������������������������������������ 447

Adding Your Developer Account to Xcode ���������������������������������������������������������������������������������������������������������� 454

The Devices Organizer ��������������������������������������������������������������������������������������������������������������456

Preparing a Device for Development ����������������������������������������������������������������������������������������������������������������� 457

Deploying an Application to an iOS Device �������������������������������������������������������������������������������������������������������� 459

Capturing a Screenshot from a Running Application ����������������������������������������������������������������������������������������� 461

Using a Screenshot as a Launch Image������������������������������������������������������������������������������������������������������������� 463

Page 14: Beginning Xcode - link.springer.com

xiv Contents

The Projects Organizer ��������������������������������������������������������������������������������������������������������������467

Using the Project and Workspace List ��������������������������������������������������������������������������������������������������������������� 467

Using Snapshots ������������������������������������������������������������������������������������������������������������������������������������������������ 468

The Archives Organizer �������������������������������������������������������������������������������������������������������������474

Archiving Your Application ��������������������������������������������������������������������������������������������������������������������������������� 474

Summary �����������������������������������������������������������������������������������������������������������������������������������477

Chapter 15: Building, Sharing, and Distributing Applications ■ ���������������������������������������479

Final Checks Before Publishing Your Application ����������������������������������������������������������������������480

Discovering iTunes Connect ������������������������������������������������������������������������������������������������������482

Creating an App ID ��������������������������������������������������������������������������������������������������������������������������������������������� 486

Creating an Application Profile �������������������������������������������������������������������������������������������������������������������������� 489

Uploading an Application to iTunes Connect �����������������������������������������������������������������������������495

Getting Ready to Upload ������������������������������������������������������������������������������������������������������������������������������������ 495

Creating a Distribution Certificate and Profile ��������������������������������������������������������������������������������������������������� 497

Validating Your Application �������������������������������������������������������������������������������������������������������������������������������� 505

Submitting Your Application to the App Store ����������������������������������������������������������������������������508

Submitting Applications Using Archives Organizer �������������������������������������������������������������������������������������������� 508

Canceling Your Submission ������������������������������������������������������������������������������������������������������������������������������� 510

Submitting Applications Using Application Loader ��������������������������������������������������������������������511

Summary �����������������������������������������������������������������������������������������������������������������������������������514

Next Steps ���������������������������������������������������������������������������������������������������������������������������������515

Index ���������������������������������������������������������������������������������������������������������������������������������517

Page 15: Beginning Xcode - link.springer.com

xv

About the Author

Matthew Knott has been writing code for as long as he can remember; from marveling at moving pixels on a BBC Micro to writing ridiculous text adventures for his mother on an overheating ZX Spectrum 48k. Matthew has been a professional software developer for the past 12 years, six of which have been spent in the education sector where he has now entered the sometimes-scary world of management, although when they see the mess he made of the budget, that won’t last long. Matthew’s work and hobby are basically the same things, but when he’s not working, he is loving life in a beautiful part of Wales with his wife, Lisa, and two kids, Mikey and Charlotte.

Page 16: Beginning Xcode - link.springer.com
Page 17: Beginning Xcode - link.springer.com

xvii

About the Technical Reviewer

Felipe Laso Marsetti is an iOS programmer working at Lextech Global Services. He loves everything related to Apple, video games, cooking, and playing the violin, piano, or guitar. In his spare time, Felipe loves to read and learn new programming languages or technologies.

Felipe likes to write on his blog at http://iFe.li, create iOS tutorials and articles as a member of http://www.raywenderlich.com, or work as a technical reviewer for Objective-C- and iOS-related books. You can find him on Twitter as @Airjordan12345, on Facebook under his name, or on App.net as @iFeli.

Page 18: Beginning Xcode - link.springer.com
Page 19: Beginning Xcode - link.springer.com

xix

Acknowledgments

I’d always thought that when it came to acknowledgments, everyone thanked their family, and they possibly did so out of some idea of routine for this sort of thing. Having gone through the process myself now, I realize that it’s just not possible to write a book without neglecting your family while continuing to receive their love and support.

With that in mind, I have to acknowledge the role my wife and my children played in making this dream become a reality.

I’d also like to thank Steve, Douglas, and Mark at Apress for their support over the years and specifically their belief and encouragement on this project.

Thanks also to Anamika, Mary and Felipe for keeping everything ship shape along the way.

Finally, a special thank you to my good friend and colleague Phil, whose continuous good humor, generosity, and sage-like wisdom have helped to keep me going through many tough times.

Page 20: Beginning Xcode - link.springer.com
Page 21: Beginning Xcode - link.springer.com

xxi

Introduction

Welcome to Beginning Xcode, the book that aims to give you all of the knowledge to start writing applications using what is probably the most powerful integrated development environment (IDE) ever, and it’s free.

As with many Apple products, Xcode has simplicity and ease of use in abundance, but don’t be fooled; the shiny exterior masks a workhorse of a tool, incredibly powerful with an extensive set of integrated tools for every eventuality. Xcode is the development environment that all other IDEs have a poster of pinned to their bedroom walls.

Xcode hasn’t always been this shining Rock God of awesomeness; it used to be a sorry band of ragtag applications. When I first picked up Xcode 3 in 2007, I remember going through a multitude of different applications to perform varying tasks, such as the very basic Interface Builder, and finding out how to adapt my knowledge of C into Objective-C. Back then what I really wanted was something that showed me how to get the most out of Xcode and give me the understanding I needed to get going with the hundreds of app ideas I had in my head.

Fast forward six years and both myself and Xcode have come a long way. I feel as if I’ve gone from a kid, bumping my leaky paddle boat aimlessly around a boating lake, to a handsome sea captain at the prow of my vessel, gazing forth as I slice through choppy waves with grace and ease. Well, aside from the handsome part, the analogy is a good one. Xcode 5 is now a complete, integrated product that puts the same power in your hands as the developers at Apple who write the apps found in iOS and Mac OS X.

Throughout this book I aim to guide you through every facet of Xcode, helping you to understand the capabilities of each of the key areas as you build a number of cool and exciting projects along the way.

By the end of the book, you should be ready to turn the ideas in your head into reality, and I can’t wait to see what that looks like.