Skip to main content

AUD $46.95

*Price and Tax

Swift For Dummies

Jesse Feiler

ISBN: 978-1-119-02222-0 February 2015 384 Pages


Get up and running with Swift—swiftly

Brimming with expert advice and easy-to-follow instructions, Swift For Dummies shows new and existing programmers how to quickly port existing Objective-C applications into Swift and get into the swing of the new language like a pro. Designed from the ground up to be a simpler programming language, it's never been easier to get started creating apps for the iPhone or iPad, or applications for Mac OS X.

Inside the book, you'll find out how to set up Xcode for a new Swift application, use operators, objects, and data types, and control program flow with conditional statements. You'll also get the scoop on creating new functions, statements, and declarations, learn useful patterns in an object-oriented environment, and take advantage of frameworks to speed your coding along. Plus, you'll find out how Swift does away with pointer variables and how to reference and dereference variables instead.

  • Set up a playground development environment for Mac, iPhone, iPad, and wearable computers
  • Move an existing Objective-C program to Swift
  • Take advantage of framework components and subcomponents
  • Create an app that uses location, mapping, and social media

Whether you're an existing Objective-C programmer looking to port your code to Swift or you've never programmed for Apple in the past, this fun and friendly guide gets you up to speed swiftly.

Introduction 1

Part I: Getting Started with Swift 5

Chapter 1: Setting Up an Xcode Swift Project 7

Chapter 2: Playing in the Playground 39

Chapter 3: Using the Xcode Editing Tools 47

Chapter 4: Creating a Swift App 63

Part II: Introducing Actions 105

Chapter 5: Operating on Data 107

Chapter 6: Using Swift Types  127

Chapter 7: Collecting Objects 153

Chapter 8: Controlling the Flow 175

Chapter 9: Functioning Successfully 191

Part III: Putting Expressions Together 217

Chapter 10: Expressing Yourself 219

Chapter 11: Declaring the Symbols 235

Chapter 12: Initializing and Deinitializing Data 243

Part IV: Using Components and Subcomponents 255

Chapter 13: Expanding Objects with Extensions 257

Chapter 14: Managing Access Control for Your Objects 267

Chapter 15: Building Classes, Structures, and Enumerations 273

Chapter 16: Using Properties, Variables, Outlets, and Actions 287

Chapter 17: Working with Enumerations to Consolidate Values 273

Chapter 18: Using Protocols to Provide Templates for Functionality 313

Chapter 19: Mixing Objective-C and Swift 327

Part V: The Part of Tens 335

Chapter 20: Ten Swift Features That Aren’t in Objective-C 337

Chapter 21: Ten Swift Features That Are Not in C 341

Chapter 22: Ten Objective-C Features That Aren’t in Swift 345

Index 349

Code examples from Chapter 1
Code examples from Chapter 4
Code examples from Chapter 7
Code examples from Chapter 8
Code examples from Chapter 9
Code examples from Chapter 12
Code examples from Chapter 15
Code examples from Chapter 17
Code examples from Chapter 18
Code examples from Chapter 19
All the code examples from Swift For Dummies