juniorSwift

What is a class in Swift?

Updated May 17, 2026

Short answer

Classes are reference types supporting inheritance.

Deep explanation

Unlike structs, classes share references. Changes affect all references pointing to the same object.

Real-world example

Used for complex objects like ViewControllers.

Common mistakes

  • Confusing value vs reference behavior.

Follow-up questions

  • What is inheritance?
  • Do classes support ARC?

More Swift interview questions

View all →