-
Notifications
You must be signed in to change notification settings - Fork 322
Minimize NSObject inheritance #2352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ogress, RouteStepProgress, DataCache, FeedbackItem, NavigationOptions, StyleManager
…tings update notifications
…ndler callback to respond to legIndex updates
@@ -34,15 +34,16 @@ open class RouteController: NSObject { | |||
} | |||
|
|||
private var _routeProgress: RouteProgress { | |||
willSet { | |||
resetObservation(for: _routeProgress) | |||
} | |||
didSet { | |||
movementsAwayFromRoute = 0 | |||
updateNavigator(with: _routeProgress) | |||
updateObservation(for: _routeProgress) |
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.
Shouldn't we not only subscribe to legIndex
updates here, but also run the subscription handler too to update RouteController
with new _routeProgress
?
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.
I'm not sure what you mean by this? _routeProgress
is the memoized property that represent's RouteController
's copy of the current route progress.
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.
When _routeProgress
is set, we observe it's legIndex
to call updateRouteLeg
when it is updated. But shouldn't we call updateRouteLeg
right now, since we've just updated the entire _routeProgress
and thus it's legIndex
is technically updated too.
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.
@Udumft No, it's unnecessary, because the leg is set when we call updateNavigator(with:)
.
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.
Looks good! I'm not sure if this question you asked is stale or not.
@@ -34,15 +34,16 @@ open class RouteController: NSObject { | |||
} | |||
|
|||
private var _routeProgress: RouteProgress { | |||
willSet { | |||
resetObservation(for: _routeProgress) | |||
} | |||
didSet { | |||
movementsAwayFromRoute = 0 | |||
updateNavigator(with: _routeProgress) | |||
updateObservation(for: _routeProgress) |
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.
I'm not sure what you mean by this? _routeProgress
is the memoized property that represent's RouteController
's copy of the current route progress.
Resolves #2294
Removes some objects NSObject Inheritance. Existing KVO observers are removed in favor of using NSNotifications observations.
There are also some other Public available classes, inheriting NSObject:
Didn't check in detail, if such inheritance is legitimate, but quick removing NSObject from declaration showed successful compile. Should I check these too?