P. 54: Incrementing an NSManagedObject property?

The book does this:

  let times = currentBowtie.timesWorn
  currentBowtie.timesWorn = times + 1

Why would’t you simply do this:

  currentBowtie.timesWorn += 1

@pietrorea Can you please help with this when you get a chance? Thank you - much appreciated! :]

@7stud Thanks very much for your question!

The reason why you wouldn’t use:

currentBowtie.timesWorn += 1

is because the “+=” function is now deprecated, as can be seen in the following screen shot:


I hope this helps!

All the best!