You're designing an API for a payment processor. Multiple concrete types (`CreditCard`, `PayPal`, `ApplePay`) must all be usable wherever a `PaymentMethod` is expected. Which Swift mechanism is most appropriate?
-
A
A base class that all types subclass
-
B
A protocol that all types conform to
-
C
A generic function constrained to Codable
-
D
A typealias grouping the three types