XCode 操场:无法查找符号



在SwiftUI Playground和MapKit上与朋友合作不会在我的机器上加载,但会在他的机器上加载。

我收到的错误是:

expression failed to parse:
error: Couldn't lookup symbols:
nominal type descriptor for _MapKit_SwiftUI._DefaultMapContent

相关代码为:

import SwiftUI
import PlaygroundSupport
import MapKit
struct SearchView: View {
@State private var mapRegion = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 35.1195684, longitude: -90.0632266), span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2))
...
var body: some View {
ZStack{
Map(coordinateRegion: $mapRegion)
.zIndex(0)
.onChange(of: mapRegion) { _ in
userMovedMap = true
print(userMovedMap, showReloadButton, timerAnimation.isActive)
timerAnimation.objectWillChange.send()
}
...
}
PlaygroundPage.current.setLiveView(SearchView()
.frame(width: SCREEN_SIZE.width, height:SCREEN_SIZE.height))

为什么这个操场不在我的机器上运行,而在他的机器上运行?(使用Xcode 13.4.1和MacOS 12.5(

游乐场非常古怪。我通常做的是尽可能多地使用SPM进行模块化,并且只运行依赖于一个或两个库的东西,

另一条建议是关闭自动运行,有时处理这些计划可能会有所帮助,尽管我不确定这是否是轶事。

点击此处查看更多信息:https://www.swiftbysundell.com/articles/swift-playgrounds-tips-tricks/

最新更新