Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwifttype erasureSingle-choice MCQ

Consider this type-erasing wrapper. What problem does the `_box` / `AnyBase` / `Box` three-type pattern solve that a single concrete wrapper struct cannot?

struct AnyShape { private let _area: () -> Double init<S: Shape>(_ shape: S) { _area = { shape.area() } } func area() -> Double { _area() } }