I have this class:
@interface RSSEntry : NSObject{
NSString *blogTitle;
NSString *articleTitle;
NSString *articleUrl;
NSDate *articleDate;
}
@property (copy) NSString *blogTitle;
@property (copy) NSString *articleTitle;
@property (copy) NSString *articleUrl;
@property (copy) NSDate *articleDate;
@end
Now, how will I make these member variables get initialized when creating an object, especially when ARC is enabled in the Xcode project? I'm new to Objective-C; I'm looking for something like constructor from C base languages.
In Objective-C there are no constructors. However, it is a common practice to create init
method and have users call alloc
immediately followed by init
. See Objective-C constructors for example.