Objective-C 中是否有一种简单的方法可以将方法中的所有参数设置为类的属性?类似于 setValuesForKeysWithDictionary,但更像“setValuesForKeysWithArguments”?
假的例子:
@interface SomeClass : NSObject
@property (weak, nonatomic) NSString *foo;
@property (weak, nonatomic) NSString *bar;
- (id)initWithFoo:(NSString *)foo Bar:(NSString *)bar;
@end
@implementation SomeClass
- (id)initWithFoo:(NSString *)foo Bar:(NSString *)bar{
// Mythical implementation begins here
[self setValuesForKeysWithArguments:theArgumentsWeJustPassedToThisMethod];
}
@end