Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftownership borrowing consumingSingle-choice MCQ

Consider these two parameter ownership conventions. What is the key difference the compiler enforces at the call site, in terms of retain/release traffic and the caller's continued ability to use the argument?

final class Node { var v = 0 } func viaBorrow(_ n: borrowing Node) { _ = n.v } func viaConsume(_ n: consuming Node) { _ = n.v } let node = Node() viaBorrow(node) // (A) use node here viaConsume(node) // (B) use node here