1

I want to extend my usage of Swift Property Observers beyond scalar values like Double, String, Int, etc... to [Double], [String], [Int]. While it useful (using didSet & willSet) to know when the whole Array struct has been modified it is often beneficial to know which index in the array changed - for example so that unnecessary secondary computations can be avoided.

How is this achieved?

Sam
  • 2,745
  • 3
  • 20
  • 42
  • possible duplicate of [computed setter for a subscript of an array in Swift](http://stackoverflow.com/questions/27675288/computed-setter-for-a-subscript-of-an-array-in-swift) – jrturton Dec 29 '14 at 09:11
  • Thanks @jrturton. I was hoping for a more directly supported way (Swift syntax) but the suggested approach will work. – Sam Dec 29 '14 at 10:02
  • It would be nice to have it built in to Swift! – jrturton Dec 29 '14 at 10:11

0 Answers0