Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftcopy-on-write internalsSingle-choice MCQ

A struct with a single class-typed stored property is passed by value into a function that does not mutate it. Why does passing this struct still incur reference-counting traffic even though no copy-on-write buffer is forked?

final class Box { var n = 0 } struct Wrapper { let box: Box } func use(_ w: Wrapper) { _ = w.box.n }