Let's say I have something like this:
func myFunc() -> (Any, Any)? {...}
func anotherFunc() {
if var (a, b) = myFunc() {
a = b
}
}
I need it varfor the tuple, because it is amutated, but Xcode complains that " bnever mutated, think about using let" - this is a somewhat reasonable argument, but I can not define the tuple as (var, let).
I suggest that I could use an index to access two elements instead of declaring them, bypassing this problem. But is there a better way?
source
share