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.

Cannot cast MGLStyleValue to qualified MGLStyleConstantValue or MGLStyleFunction #6823

Closed

Description

@1ec5

The following code:

let layer = style.layer(withIdentifier: "symbols") as? MGLSymbolStyleLayer
let constantValue = layer.textField as? MGLStyleConstantValue<NSString>

produces the following warning in Swift 3:

/path/to/Coercion/ViewController.swift:240:56: Cast from 'MGLStyleValue<NSString>!' to unrelated type 'MGLStyleConstantValue<NSString>' always fails

The generated Swift interface for MGLStyleConstantValue has the following class signature:

open class MGLStyleConstantValue<T : AnyObject> : MGLStyleValue<AnyObject>

MGLStyleConstantValue should inherit from MGLStyleValue<T> rather than MGLStyleValue<AnyObject>.

/cc @boundsj @friedbunny

Activity

  1. added
    iOS
    macOS
    on Oct 26, 2016
  2. added this to the ios-v3.4.0 milestone on Oct 26, 2016
  3. self-assigned this
    on Oct 26, 2016
  4. added 2 commits that reference this issue on Oct 26, 2016
    e91e2e9
    62647a0
  5. added
    release blocker
    on Oct 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugiOSmacOSrelease blockerruntime styling

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions