Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Reverse MGLStyle.layers #7474

@1ec5

Description

@1ec5

MGLStyle’s layers property should be ordered from back to front, not from front to back.

In #6097, I said:

The layers array is ordered from front to back, for consistency with Cocoa, as opposed to mbgl’s back-to-front ordering.

I was mistaken: similar arrays in Cocoa are ordered from back to front (NSView.subviews, UIView.subviews, UIApplication.windows) or specify no explicit order (NSApplication.windows). (Apple Events and AppleScript do treat “front” as a synonym for “first” and “back” as a synonym for “last”, but that shouldn’t inform the API we expose in this SDK.)

I think a last-minute breaking change before the release is probably the right decision in the long run. Reversing the array will simplify MGLStyle somewhat, as it removes an impedance mismatch with mbgl. It’ll also make the iOS and macOS SDKs more consistent with the Android SDK and GL JS. Moreover, the layers property was only published a few days ago in beta 5, along with more convenient methods like -insertLayer:aboveLayer:, so direct indexing into layers should be relatively rare.

/cc @boundsj @frederoni @ericrwolfe @bsudekum

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions