midiOS

What are protocols in Swift?

Updated May 6, 2026

Short answer

Protocols define a blueprint of methods and properties.

Deep explanation

They enable abstraction and polymorphism without inheritance.

Real-world example

UITableViewDataSource is a protocol.

Common mistakes

  • Overusing class inheritance instead of protocols.

Follow-up questions

  • What is protocol composition?
  • Can protocols have default implementations?

More iOS interview questions

View all →