O'Reilly logo

Beginning Swift Programming by Wei-Meng Lee

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 Introduction to Swift

WHAT YOU WILL LEARN IN THIS CHAPTER:            

  • What Swift is
  • Why Swift is important
  • Setting up the development environment to learn Swift
  • How to create a Playground project
  • How to create an iOS project
  • The syntax of Swift
  • How to declare constants
  • How to declare variables
  • Using string interpolation to include variable values in strings
  • Swift statements
  • How to print the values of variables for debugging
  • How to insert comments in your Swift code

Apple surprised the Mac and iOS developer world at the Apple World Wide Developers Conference (WWDC) 2014 with the announcement of a new programming language: Swift. The aim of Swift is to replace Objective-C with a much more modern language syntax without worrying too much about the constraints of C compatibility. Apple itself touted Swift as Objective-C without the C.

For developers already deeply entrenched in Objective-C, it is foreseeable that Objective-C will still be the supported language for iOS and Mac OS X development in the near and immediate future. However, signs are all pointing to Apple’s intention to make Swift the future language of choice for iOS and Mac development.

In this chapter, you will learn about the basics of Swift and how you can set up the development environment to learn it.

WHAT IS SWIFT?

Swift is a new programming language designed by Apple for Cocoa (Mac OS X) and Cocoa Touch (iOS) programming. The syntax of Swift is similar to modern languages such as Java and C#, while at ...

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