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.

$lineProgress inside NSExpression for lineGradient not recognized as variable #12917

Closed

Description

@stoeffn

Hey there,

I'm trying to apply a lineGradient to an MGLLineStyleLayer but apparently, $lineProgress isn't recognized as a variable as advertised in the documentation.

Steps to reproduce

Here is my code:

layer.lineGradient = NSExpression(format: "mgl_interpolate:withCurveType:parameters:stops:($lineProgress, 'linear', nil, %@)", [0: UIColor.red, 1: UIColor.blue])

I've also attached a sample project—be sure to set your access key.

Expected behavior

The line should be interpolated from red to blue.

Actual behavior

Application crashes with the following message:

2018-09-19 13:35:15.119896+0200 MapboxTest[4379:660546] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid property value: [2][1]: Unknown variable "lineProgress". Make sure "lineProgress" has been bound in an enclosing "let" expression before using it.'
*** First throw call stack:
(0x18a30fef8 0x1894dda40 0x18a214ac4 0x101006760 0x1010171a8 0x100bab128 0x100babf38 0x100fd0754 0x100fda380 0x1010f83a8 0x100fb88f4 0x1974d68d0 0x100fb9098 0x18e7c5574 0x18a56f58c 0x18a2773e4 0x18a29ec30 0x18a29e37c 0x18a299134 0x18a2985b8 0x18c50c584 0x1b6b93558 0x100bad0b0 0x189d58b94)
libc++abi.dylib: terminating with uncaught exception of type NSException

Configuration

Mapbox SDK versions: 4.4.1
iOS versions: 12.0
Device/simulator models: iPhone 6 Plus
Xcode version: 10.0

Thanks in advance!

Activity

  1. added
    iOS
    on Sep 19, 2018
  2. added
    macOS
    on Sep 19, 2018
  3. 1ec5 commented on Oct 3, 2018

    @1ec5
    Contributor

    As a workaround until this variable is implemented, you can use MGL_FUNCTION("line-progress").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    iOSmacOSruntime styling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions