Advanced Swift: Values and References

Swift mutation model uses values and references to improve local reasoning and maintain performance. Find out the details in this course. By Ray Fix.

Leave a rating/review
Save for later
Comments
Share

Learning path

This is part of the Advanced Swift learning path. View path.

Who is this for?

This course is for developers interested in getting a deeper understanding of the Swift language. It expects you to be comfortable with the basic syntax of Swift and to have perhaps written an app or two. You should be familiar with basic types in the Swift standard library.

Covered concepts

This course focuses on:

  • Values
  • References
  • Copy on write
  • Exclusivity
  • inout
  • self

01
Toggle description

Both value types and reference types can be used together to boost local reasoning without sacrificing performance.

Toggle description

References give you "spooky-action-at-a-distance" that can be leveraged to solve certain kinds of problems very well.

inout 3:31
Toggle description

In this video, let's take a look at inout: the mechanism which underpins the mutation model in Swift.

Toggle description

Find out how self is passed implicitly to models and can be marked inout with mutating in this video.

Toggle description

The Law Exclusivity for memory is another Swift mechanism that improves local reasoning. Learn all about it in this video.

COW 4:48
Toggle description

Copy-on-write is a great way to keep value semantics cheap. Let's take a look at how to implement it.

Toggle description

In this challenge you will try to implement a copy-on-write that reduces reference counting traffic.

Conclusion 1:25
Toggle description

You have seen how values and references work with Swift and how you can use COW to optimize performance and correctness with value type semantics.

Up next

Multiple Domains
Advanced Swift: Types and Operations
An idea central to Swift is to use types to guarantee correctness. Find out how in this course focused on types and operations.

Instructors

Contributors

Ray Fix

Instructor

JORGE R. MOUKEL

Tech Editor

Over 300 content creators. Join our team.