Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should i use assign in Objective c?

I understand the reason i should use retain, but why should I ever use assign? (besides to avoid retain cycles)

[EDIT] So if i understand Chuck's answer on https://stackoverflow.com/questions... correctly, when ever I use assign, the variable would lose scope once it gets out of scope of the method just like it does in regular C-type language behavior?

like image 485
stackoverflow Avatar asked Feb 03 '12 20:02

stackoverflow


1 Answers

You should assign things that aren't objects. Any C type (such as int, float, char, double, struct, and enum) should be assigned.

like image 53
DHamrick Avatar answered Oct 16 '22 22:10

DHamrick