Dismantle mapview

I am trying to remove all references when I leave my mapview. Thought I would try this but I don't think it is called:

private func dismantleUIView(_ view: MKMapView, coordinator: MapCoordinator) {
var cancellableSet: Set =
cancellableSet.removeAll()
}

This is why I am trying this to avoid the following error message:

Atlas page destroyed with outstanding references.: Assertion with expression - _textureRefs == 0 : Failed in file - /Library/Caches/com.apple.xbs/Sources/VectorKit/VectorKit-1606.34.10.29.27/src/TextureAtlas.cpp line - 604

For Apple specific APIs, the Apple Developer Forums are preferred since this question is not about Swift the language itself.


That said, what you are doing at the moment is

  1. Creating an empty set.
  2. Removing all zero items from that empty set.

which does not affect the map view.

Someone on Stackoverflow recommends removing all the annotations from the map, so you might want to try something like this.

private func dismantleUIView(_ view: MKMapView, coordinator: MapCoordinator) {
    for annotation in view.annotations {
        view.removeAnnotation(annotation)
    }
}

Thank you
Not sure why but this seemed to solve all my problems for now:

Not sure how this fixed the problem but the error went away.

.frame(width: .infinity, height: 8, alignment: .center)

this is what I changed it to:

.frame(minWidth: 0, maxWidth: .infinity, alignment: .center)

Thanks alot

Terms of Service

Privacy Policy

Cookie Policy