mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.35k stars 1.33k forks source link

On iOS 14 MGLAnnotationView slows down map significantly #16513

Closed flashspys closed 4 years ago

flashspys commented 4 years ago

The addition of even one custom MGLAnnotationView make the map unusable. The attached image shows the profiler where the mapbox rendering call is taking the most of the cpu. There is only a basic map showing one custom annotation. On iOS 13 this runs butter smooth. The Map is displayed via a UIViewRepresentable in SwiftUI.

image

Steps to reproduce

  1. On iOS 14, create a MGLMapView and display one custom MGLAnnotationView.

Expected behavior

Map runs smooth

Actual behavior

Map is unusable slow

Configuration

The used custom MGLAnnotationView:

class CustomAnnotationView: MGLAnnotationView {
    override func layoutSubviews() {
        super.layoutSubviews()
        layer.cornerRadius = bounds.width / 2
        layer.borderWidth = 2
        layer.borderColor = UIColor.white.cgColor
    }
}

Mapbox SDK version: 6.0.0 iOS versions: iPad OS 14 / iOS 13.6 Device/simulator models: iPad Pro 1st Gen (iOS 14 device) / iPhone Xs (iOS 13 device) Xcode version: 12.0 b2

flashspys commented 4 years ago

Wrong repo, I'm sorry. Reopened here: https://github.com/mapbox/mapbox-gl-native-ios/issues/350