【问题标题】:Cannot convert value of type 'Binding<CLLocationCoordinate2D>' to expected argument type 'CLLocationCoordinate2D'无法将“Binding<CLLocationCoordinate2D>”类型的值转换为预期的参数类型“CLLocationCoordinate2D”
【发布时间】:2022-06-24 21:46:25
【问题描述】:

当我使用 MapKit 时,我很快就遇到了这个问题

在模型中我有var locations: [NPOAnnotations]

和班级

class NPOAnnotation: NSObject, MKAnnotation, Identifiable{
    var title: String?
    var coordinate: CLLocationCoordinate2D

    init(title: String, coordinate: CLLocationCoordinate2D) {
        self.title = title
        self.coordinate = coordinate
    }
}

【问题讨论】:

    标签: xcode swiftui mapkit cllocationcoordinate2d


    【解决方案1】:

    从中删除$

    annotationItems: $viewModel.locations
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-23
      • 2020-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多