[swift-users] edit array

J.E. Schotsman jeschot at xs4all.nl
Wed Apr 26 09:15:07 CDT 2017


Simple question: why can’t I edit a variable array with a functional method?

For example:

struct TestStruct
	{
	var number = 0
	}

var array = [TestStruct](repeatElement(TestStruct(), count: 2))
array.forEach { $0.number += 1 }

Jan E.


More information about the swift-users mailing list