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

Phantom types let you tag a generic type with a marker that carries no stored data. Given this code, what does the compiler do with the `currency` parameter at runtime?

enum USD {} enum EUR {} struct Money<Currency> { let cents: Int } func add<C>(_ a: Money<C>, _ b: Money<C>) -> Money<C> { Money(cents: a.cents + b.cents) } let wallet = Money<USD>(cents: 500)