Swift 3, turned every property passed into a function into a Let constant.
This means you can't make changes to a property passed into a function, utterly destroying the approach i take to recursively editing tree data.
How, in Swift are you suppossed to recursivly traverse and update tree data? There aren't any for-loops for this stuff. I used to recursively call the same Function for every object in the hierarchy. Impossible now.
The question is, what kind of type is Node? Is it a reference type or a value type (a class or a struct)?
If it's a reference type, then you can change the properties of the object referenced by myVariable without making it "inout". You'd only need "inout" if you wanted the caller if the reference itself changed.
If it's a value type, you need "inout" to modify the caller's value. However, this may still not be enough, depending what's happening at the calling location. For example, let's say Node is a struct with a "nextNode" property, used to make a chain of nodes, and suppose you have code like this:
var someNode = …
var nextNode = someNode.nextNode
myFunc (&nextNode)This will mutate the value of nextNode, but leave someNode.nextNode alone, because nextNode is a copy of someNode.nextNode. If you have a chain or tree structure made out of value types, then you need a "trail" of "inout" parameters all the way back to the original structure, and you have to be very careful never to modify a copy.
For that reason, in a case like this, where you want to mutate a tree, it's best to use a reference type (class), and in that case you don't need "inout" in most situations.
If you think something isn't working right (like "inout") you have to post some actual code fragments, including the calling site and the called code. Tell us what you expected to happen, and what did happen, and how you found that out. Waving hands around generalities isn't much help at this point.