Skip to content

Commit 1055d8a

Browse files
committed
Cleanup updateAnnotation
1 parent 9585d1f commit 1055d8a

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

ios/Classes/Annotations/AnnotationController.swift

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,19 @@ extension AppleMapController: AnnotationDelegate {
205205
}
206206

207207
private func updateAnnotation(annotation: FlutterAnnotation) {
208-
if self.annotationExists(with: annotation.id) {
209-
let oldAnnotation = self.getAnnotation(with: annotation.id)
210-
211-
208+
if let oldAnnotation = self.getAnnotation(with: annotation.id) {
212209
UIView.animate(withDuration: 0.32, animations: {
213-
oldAnnotation?.coordinate = annotation.coordinate
214-
oldAnnotation?.zIndex = annotation.zIndex
215-
oldAnnotation?.anchor = annotation.anchor
216-
oldAnnotation?.alpha = annotation.alpha
217-
oldAnnotation?.isVisible = annotation.isVisible
218-
oldAnnotation?.title = annotation.title
219-
oldAnnotation?.subtitle = annotation.subtitle
210+
oldAnnotation.coordinate = annotation.coordinate
211+
oldAnnotation.zIndex = annotation.zIndex
212+
oldAnnotation.anchor = annotation.anchor
213+
oldAnnotation.alpha = annotation.alpha
214+
oldAnnotation.isVisible = annotation.isVisible
215+
oldAnnotation.title = annotation.title
216+
oldAnnotation.subtitle = annotation.subtitle
220217
})
221218

222219
// Update the annotation view with the new image
223-
if let view = self.mapView.view(for: oldAnnotation!) {
220+
if let view = self.mapView.view(for: oldAnnotation) {
224221
let newAnnotationView = getAnnotationView(annotation: annotation)
225222
view.image = newAnnotationView.image
226223
}

0 commit comments

Comments
 (0)