Programming in Swift: Functions & Types

Jan 4 2022 · Swift 5.5, iOS 15, Xcode 13

Part 5: Protocols & Inheritance

45. Value vs. Reference Types

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 44. Challenge: Protocols Next episode: 46. Conclusion

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 45. Value vs. Reference Types

Update Notes: This course was originally recorded in 2019. It has been reviewed and all content and materials updated as of October 2021.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Before I wrap up this course, I want to touch on a few lingering questions you might have about all of these named types.

Value vs. Reference

[Slide 01] A common big question is whether to use a structure or a class. This might also be phrased like “Should I use a value type or a reference type?”.

Extensibility

Sometimes you don’t actually have a choice. If you’re extending the behavior of code you don’t own, you may have to subclass. In that button example, it’s possible Button is part of a framework you’re using, and there’s no way you can modify or extend the source code to fit your needs.