Hey guys,
So I am busy with the NSDate class and I see there is two ways to write the code.
Option one:
This with the correct NSLog - will print the current date to the console.
Option Two: ( I hear this the Apple - approved way )
This prints the same as the first code.
How does the second code work? And why is it Apple approved?
I am reading the Big Nerd Ranch book on Object C - and they explain this part - but I still don't fully understand why - can someone elaborate for me?
Sorry if this is a very newbie question..
So I am busy with the NSDate class and I see there is two ways to write the code.
Option one:
Code:
NSDate *now = [NSDate date]
This with the correct NSLog - will print the current date to the console.
Option Two: ( I hear this the Apple - approved way )
Code:
NSDate *now = [ [NSDate alloc] init]
This prints the same as the first code.
How does the second code work? And why is it Apple approved?
I am reading the Big Nerd Ranch book on Object C - and they explain this part - but I still don't fully understand why - can someone elaborate for me?
Sorry if this is a very newbie question..