iOS ● ● ○ Swift 6

Kodebits Day 44: Protocol Conformance

Jun 21 2026
Practice protocols with a short swift challenge.

What does this print?

protocol Named {
  var name: String { get }
}
struct Item: Named {
  var name: String
}
let obj: Named = Item(name: "Box")
print(obj.name)


Try it in the online Swift Playground →

[spoiler title="Solution"]

Answer:

Box

Explanation:

Protocols define requirements; structs can conform and be used as protocol types.

[/spoiler]


Further Reading