Hey there, quick question here. I\'m sure there\'s a simple answer.
Coming from PHP, I\'m used to declaring a function with a default argument value like this:
You can easily achieve the same effect using #define.
The function in your header file:
+(NSDate*)getDateFromYear:(NSUInteger)year month:(NSUInteger)month day:(NSUInteger)day;
Add a #define for parameter function in header file:
#define GetDateFromYearOnly(year) [YourClassName getDateFromYear:year month:1 day:1]
Then your can use the function like:
NSDate* 2015Date = GetDateFromYearOnly(2015);
And you will get an NSDate object with date 2015/01/01.
If the function is not static, build a new function like this:
-(NSDate*)GetDateFromYearOnly:(NSUInteger)year;
And call:
[self getDateFromYear:year month:1 day:1]