Following on from @Jason Coco answer.
Here is my offering on how to check specifically for the "set" selectors existence of the property you're trying to set.
This is pure filth but it works and I've found myself using it. You've been warned..
NS_INLINE SEL _Nonnull IBPropertySetSelectorForPropertyName(NSString*_Nonnull propertyName)
{
NSString* firstLetter = [propertyName substringToIndex:1];
propertyName = [propertyName substringFromIndex:1];
propertyName = [[NSString alloc] initWithFormat:@"set%@%@:",firstLetter.capitalizedString,propertyName];
return NSSelectorFromString(propertyName);
}
Usage:
In swift:
Add the code snippet to your bridging header then:
let key = "someKey"
let sel = IBPropertySetSelectorForPropertyName(key)
if SOMETHING.responds(to: sel) {SOMETHING.setValue(value, forKeyPath: key)}