Book Image

Beginning Swift

By : Rob Kerr, Kåre Morstøl
Book Image

Beginning Swift

By: Rob Kerr, Kåre Morstøl

Overview of this book

Take your first foray into programming for Apple devices with Swift.Swift is fundamentally different from Objective-C, as it is a protocol-oriented language. While you can still write normal object-oriented code in Swift, it requires a new way of thinking to take advantage of its powerful features and a solid understanding of the basics to become productive.
Table of Contents (10 chapters)

Swift Operators

Operators are special characters—usually drawn from mathematics—that are used to process evaluations, modify variable values, and combine values. Swift operators break down into categories by the function they perform:

  • Assignment operators

  • Arithmetic operators

  • Comparison operators

  • Logical operators

  • Bitwise operators

  • Nil-coalescing operators

  • Range operators

Refer to the following diagram:

Swift implements its assignment, arithmetic, comparison, logical, and bitwise operators nearly identically to other C-inspired languages, such as C++, Java, and C#—so your previous experience with these operators will apply directly to Swift programming.

In this lesson, we'll summarize this common set of operators, and only highlight unique Swift implementations. Should you need detailed information on the meaning of any of these operators, please refer to Apple's The Swift Programming Language guide (