Can You Answer This Swift Question Correctly?

Only half of Swift developers can get this right

Steven Curtis
2 min readJan 20, 2023

Difficulty: Beginner | Easy | Normal | Challenging

Prerequisites:

  • Be able to produce a “Hello, World!” iOS application (guide HERE)

Terminology

Equatable: A protocol that can be applied to a type to allow value equality.

initializer: methods used to create an instance of a particular type.

Property Observers: Change and respond to changes in a property value. In Swift this is through didSet and willSet.

didSet: A property observer called immediately after a new value is stored.

willSet: A property observer called just before a value is stored.

There are a number of Swift Twitter quiz questions floating around on Twitter. One such question seems to have tripped up 50% of Swift developers:

--

--