-
Notifications
You must be signed in to change notification settings - Fork 122
Switch to KVO for configuration values #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! thank you - just a couple of minor tweaks needed I think.
platform/ios/src/MGLMapboxEvents.m
Outdated
@catch (NSException *exception) {} //Purposefully unhandled. This should only fail if we are unable to add an observer in the first place. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does/can this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unlikely. But if, for example, another class were to observe this same parameter and removed the observer and then we tried to remove the same observer a second time in this class then it could cause a crash. Since we're setting this at init and only use these keys within this class; I don't think it should happen but I just wanted to add it as a precaution (even if it is an unnecessary one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous code comment probably wouldn't happen. I cleaned the comment up with the more realistic scenario as well.
Also cleans up comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with the exception reporting suggestion
This should reduce the amount of callbacks we get from NSUserDefaults changes.