Chapter    7

Swift Classes, Objects, and Methods

If you haven’t already read Chapter 6, please do so before reading this one because it provides a great introduction to some of the basics of Swift. This chapter builds on that foundation. By the end of this chapter, you can expect to have a greater understanding of the Swift language and how to use the basics to write simple programs. The best way to learn is to take small programs and write (or rewrite) them in Swift just to see how the language works.

This chapter will cover what composes a Swift class and how to interact with Swift objects via methods. It will use a simple radio station class as an example of how a Swift class is written. This will impart an understanding of how to use a Swift ...

Get Swift for Absolute Beginners now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.