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

Phantom types use a generic parameter that appears only in the type, never in stored data. What compile-time guarantee does `Measurement` give here?

enum Meters {} enum Feet {} struct Distance<Unit> { let value: Double } let a = Distance<Meters>(value: 5) let b = Distance<Feet>(value: 5)