Я хочу написать метод init
в swift
, здесь я дал NSObject
класс модели в Objective-C
-(id)initWithNewsDictionary:(NSDictionary *)dictionary
{
self = [super init];
if (self) {
self.title = dictionary[@"title"];
self.shortDescription = dictionary[@"description"];
self.newsDescription = dictionary[@"content:encoded"];
self.link = dictionary[@"link"];
self.pubDate = [self getDate:dictionary[@"pubDate"]];
}
return self;
}
Как я могу написать этот метод в swift
?