Chapter 3. Swift objects

This chapter covers

  • Exploring objects, methods, and parameters in Swift
  • Initializing properties
  • Comparing inheritance with protocols
  • Differentiating between classes and structs
  • Exploring ways to extend your code

It’s impossible to do anything in iOS development without using objects. Views are objects, view controllers are objects, models are objects—even basic data types such as String, Int, and Array are objects in Swift!

An object in Swift is a specific instance of a type of thing. In this chapter, we’ll look at different ways of building up and structuring these types of things in your code. From experience in other languages, you may know this “type of thing” (or type) as a class. While it’s true that types ...

Get iOS Development with Swift now with O’Reilly online learning.

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