Suggested approach: You should already know that protocol conformances allow us to say that one type conforms to a protocol such as Hashable
or Equatable
, but this question is asking about conditional conformances – conforming to a protocol only if a condition is true. Make sure and give a practical example, such as Array
conforming to a Purchaseable
protocol only if it contains elements that also conform to Purchaseable
.
Estimated difficulty: Advanced
See the full list of iOS interview questions
if let
and guard let
?
weak
and unowned
?
Link copied to your pasteboard.