O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

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

Reference types versus value types

We covered this topic in Chapter 3, Types and Type Casting, but it is important to emphasize that in most OOP languages, instances can be shared and objects can be passed around with their references. This is true for Swift classes and closures as well. In those cases, it is important to understand that the state of an object can be altered when objects are shared via references. In other words, if any user of a reference to a mutable object changes the object, all other users of that object will be affected by the change.

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