I'm trying to pick up a bit of Swift lang and I'm wondering how to convert the following Objective-C into Swift:
- (void)refreshDataOnChange {
if (![tblSkillMaterials.delegate isKindOfClass:[self class]]) {
tblSkillMaterials.delegate = self;
}
if (![tblSkillMaterials.dataSource isKindOfClass:[self class]]) {
tblSkillMaterials.dataSource = self;
}
//Other Code Logic Here
}
More specifically I need to know how to use isKindOfClass in the new syntax.
func refreshDataOnChange() {
if tblSkillMaterials.delegate?.isKind(of: ?) {
tblSkillMaterials.delegate = self
}
if tblSkillMaterials.dataSource?.isKind(of: ?) {
tblSkillMaterials.dataSource = self
}
//Other Code Logic Here
}
Fetching Error Like:
Cannot convert value of type 'ViewController' to expected argument type 'AnyClass' (aka 'AnyObject.Type')