Having written several Objective-C in one method, I call +alloc, then -init, to set up the object.
object = [[MyClass alloc] init];
[object useFor:whatever]
The next few lines of code use the newly created object. If the above -inittakes too much time, I am sure that the program will not βwaitβ before starting to use the new object, is it? If not, is there a quick way to guarantee completion -init?
Sometimes I see programmers writing something line by line
if(object = [[MyClass alloc] init]) {
[object useFor:whatever];
}
Is that what I have to go for?
source
share