How can I borrow with conditional binding?

Yeah, I think you want if inout foo = &foo as proposed in Pitch: `borrow` and `inout` declaration keywords which isn't available yet. (Or I guess behind the ReferenceBindings experimental feature @dmt mentioned?)

The alternative @jameesbrown provided is your best option today:

2 Likes