Skip to content

Support isDraggable, dragBeginHandler, dragChangeHandler, dragEndHandler for PointAnnotation in SwiftUI #2360

@Yourney

Description

@Yourney

New Feature

Currently I see that I can set isDraggable in the PointAnnotation is in the initialiser:

/// Create a point annotation with a coordinate and an optional identifier
/// - Parameters:
///   - id: Optional identifier for this annotation
///   - coordinate: Coordinate where this annotation should be rendered
///   - isDraggable: Determines whether annotation can be manually moved around map
///   - isSelected: Passes the annotation's selection state
public init(id: String = UUID().uuidString, coordinate: CLLocationCoordinate2D, isSelected: Bool = false, isDraggable: Bool = false) {
     let point = Point(coordinate)
     self.init(id: id, point: point, isSelected: isSelected, isDraggable: isDraggable)
}

... but it does not seem to do anything in SwiftUI.
In the PointAnnotation.swift file it is even mentioned that this is not supported in SwiftUI:
/// - Note: In SwiftUI, draggable annotations are not supported.

Why

I would like to allow the people who use my SwiftUI app to drag PointAnnotations on the Map.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SwiftUIIssues and features related to SwiftUI support.feature 🍏When working on a new feature or feature enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions