-
Notifications
You must be signed in to change notification settings - Fork 148
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
Fix view annotation losing its feature association after update #1446
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,7 +193,7 @@ public final class ViewAnnotationManager { | |
let isHidden = !(options.visible ?? true) | ||
expectedHiddenByView[view] = isHidden | ||
viewsById[id]?.isHidden = isHidden | ||
if let id = currentFeatureId, id != options.associatedFeatureId { | ||
if let id = currentFeatureId, let updatedId = options.associatedFeatureId, id != updatedId { | ||
viewsByFeatureIds[id] = nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not quite understand this change. It looks like the same lines to me. Can you explain to me, please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, now I see – There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By unwrapping the Some sample code to illustrate this: let view = UIView()
let id = UUID().uuidString
let options = ViewAnnotationOptions(associatedFeatureId: id)
try manager.add(view, options: options)
try manager.update(view, options: ViewAnnotationOptions(width: 100, height: 100))
// previosly
manager.view(forFeatureId: id) // nil 💥
// fixed
manager.view(forFeatureId: id) // returns the view ✅ |
||
} | ||
if let featureId = options.associatedFeatureId { | ||
|
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.
Nit:
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 also probably make sense to add an explicit comment above