Group Group Group Group Group Group Group Group Group

P. 54: Incrementing an NSManagedObject property?


#1

The book does this:

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

Why would’t you simply do this:

  currentBowtie.timesWorn += 1

#2

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


#3

@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!


#5