O'Reilly logo

Professional Swift by Michael Dippery

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1

A Swift Primer

WHAT'S IN THIS CHAPTER?

  • Understanding Swift
  • Declaring constants and variables and working with Swift's data types
  • Transforming values with operators
  • Controlling code execution with conditional statements and loops
  • Defining and using Swift's enumerated data types
  • Understanding, declaring, and using functions, anonymous functions, and closures

This chapter introduces the key concepts featured in the Swift programming language and covers the language's new syntax and data types. It is not intended as an introductory guide to Swift, but rather, as a way for programmers who have already worked with Swift to refresh their knowledge of the language. Prior knowledge of C and Objective-C programming on iOS and OS X is also assumed, although the information presented in this chapter should still make sense to those with no experience in C and Objective-C.

If you are already familiar with the foundations of the Swift programming language, you may want to dive right in with Chapter 2. Chapter 2 also shows you how to use Xcode's new playgrounds feature, which allows you to experiment with the effects of Swift code as you write it. The examples in this chapter can be entered directly into a playground so you can see the results of your code immediately, without having to create an Xcode project and compile the code.

WHAT IS SWIFT?

Swift is a brand-new language, developed by Apple, that is meant to offer an alternative to Objective-C for iOS and OS X development. Although it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required