Bird
0
0

Which of these types correctly conforms to the Identifiable protocol?

easy📝 Conceptual Q2 of 15
iOS Swift - Lists and Data Display
Which of these types correctly conforms to the Identifiable protocol?
Astruct Item: Identifiable { var id: UUID }
Bstruct Item { var id: UUID }
Cclass Item { var id: Int }
Dclass Item: Identifiable { var name: String }
Step-by-Step Solution
Solution:
  1. Step 1: Check protocol conformance

    Only types that declare conformance to Identifiable and have an id property conform correctly.
  2. Step 2: Analyze each option

    struct Item: Identifiable { var id: UUID } declares conformance and has id. Others either lack conformance or the required property.
  3. Final Answer:

    struct Item: Identifiable { var id: UUID } -> Option A
  4. Quick Check:

    Conformance + id property = B [OK]
Quick Trick: Declare Identifiable and add id property to conform [OK]
Common Mistakes:
  • Forgetting to declare conformance
  • Using wrong property name
  • Assuming class without conformance works

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes