Capturing a struct reference in a closure doesn't allow mutations to occur
问题 I am trying to see if I can use structs for my model and was trying this. When I call vm.testClosure() , it does not change the value of x and I am not sure why. struct Model { var x = 10.0 } var m = Model() class ViewModel { let testClosure:() -> () init(inout model: Model) { testClosure = { () -> () in model.x = 30.5 } } } var vm = ViewModel(model:&m) m.x vm.testClosure() m.x 回答1: An inout argument isn't a reference to a value type – it's simply a shadow copy of that value type, that is