O'Reilly logo

Mastering Swift 4 - Fourth Edition by Jon Hoffman

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

Similarities between classes and structures

In Swift, classes and structures are more similar than they are in other languages, such as Objective-C. The following is a list of some of the features that classes and structures share:

  • Properties: These are used to store information in our classes and structures
  • Methods: These provide functionality for our classes and structures
  • Initializers: These are used when initializing instances of our classes and structures
  • Subscripts: These provide access to values using the subscript syntax
  • Extensions: These help extend both classes and structures

Now let's take a quick look at some of the differences between classes and structures.

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