Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftphantom typesSingle-choice MCQ

A common phantom-type pattern tags a wrapper with an empty marker type that is never instantiated. Which statement about the phantom-type parameter `T` below is correct?

enum Locked {} enum Unlocked {} struct Door<State> { func unlock() -> Door<Unlocked> { Door<Unlocked>() } } let d: Door<Locked> = Door<Locked>() let open = d.unlock()