Swift & Concurrency (50 Qs)•Part 3: Runtime Internals, Swift 6 Safety & Systems Programming (25 - 35)
What is Mutating functions in Structs and how does it relate to the inout parameter?
senior LevelswiftRuntime Internals
In Simple Words:
Because structs are value types, their methods cannot modify properties by default. Marking a method mutating implicitly passes self as an inout reference, writing changes back to the caller.