苹果室内地图

时间:2020-08-01 18:16:05

标签: swift swiftui mapkit

我正在从此处关注本教程:https://developer.apple.com/videos/play/wwdc2019/241/

但是,由于前进,我无法前进

Use of undeclared type 'IMDFDecodableFeature'

Use of unresolved identifier 'IMDFError'

我不确定这是否是MapKit的一部分,或者不确定本教程中的人是否在他未显示的代码中定义了这些内容,或者我运行swiftUI时是否存在兼容性问题。

还存在兼容性问题时,谷歌地图或其他供应商可以渲染用户定义的室内地图吗?

这是代码段:

import Foundation
import MapKit

class Feature<Properties: Decodable>: NSObject, IMDFDecodableFeature {
    let identifier: UUID
    let properties: Properties
    let geometry: [MKShape & MKGeoJSONObject]
    
    required init( feature: MKGeoJSONFeature) throws {
        guard let uuidString = feature.identifier else {
            throw IMDFError.invalidData
        }
        
        if let identifier = UUID( uuidString: uuidString) {
            self.identifier = identifier
        } else {
            throw IMDFError.invalidData
        }
        
        self.geometry = feature.geometry
        
        super.init()
    }
}

谢谢

1 个答案:

答案 0 :(得分:0)

我不认为此类是 MapKit 的一部分。相反,它似乎是示例代码Displaying an Indoor Map的一部分。

如果下载该文件并查看文件from tkinter import * import time root = Tk() ABC = Frame(root, bg='#010101', bd=20, relief=RIDGE) ABC.grid() ABC1 = Frame(root, bd=20, ) ABC1.grid() e = Entry(ABC1, width=30, bd=2, insertwidth=5, font=("aril", 7)) e.grid(row=1, column=0) def sent(): root.after(5000) txt = Text(ABC, height=2, width=40, padx=10, pady=10) txt.tag_config("right", justify="right") txt.pack() v = e.get() sent = "You => " + v txt.insert(END, "\n" + sent) if v == 'hai': txt = Text(ABC, height=2, width=40, padx=10, pady=10) txt.tag_config("right", justify="right") txt.pack() a = 'hello' + " <== Bot " txt.insert(END, "\n" + a, "right") txt.config(state=DISABLED) # v.delete(0, END) # txt.tag_configure("green", foreground="green") # txt.grid(column=0,row=0) b = Button(ABC1, text='sent', command=sent) b.grid(row=1, column=1) root.mainloop() ,则会看到IMDFDecoder.swiftIMDFDecodableFeature在其中声明。