Forgot Your Pointer Syntax?

When working with C, C++, or Objective-C, you know that you use pointers to reference the address (that is, the location in memory) of some value. You do this in Objective-C by using an asterisk (*). When you create a variable or constant in Swift that references some instance you created, you are not directly accessing that memory address. It is similar to a pointer but not exactly the same. Either way, you never have to reference anything using a pointer syntax when writing Swift.

The reason value types are called value types is that they are passed around as actual values. Reference types are called so because they are passed around as references that point to the actual objects. It’s the difference between using ...

Get Learning Swift™ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.