简体   繁体   English

Swift Playground 编译器错误:编译器无法在合理的时间内对该表达式进行类型检查;

[英]Swift Playground Compiler Error: The compiler is unable to type-check this expression in reasonable time;

When I was writing code running on SwiftPlayground, I got this compiling error: "The compiler is unable to type-check this expression in reasonable time"当我编写在 SwiftPlayground 上运行的代码时,出现了以下编译错误:“编译器无法在合理的时间内对该表达式进行类型检查”

public func toPlaygroundValue() -> PlaygroundValue {
    let dict: [:] = [
        "pitch": .floatingPoint(Double(pitch)),
        "roll":  .floatingPoint(Double(roll)),
        "yaw":   .floatingPoint(Double(yaw)),
        "vgx":   .floatingPoint(Double(vgx)),
        "vgy":   .floatingPoint(Double(vgy)),
        "vgz":   .floatingPoint(Double(vgz)),
        "tof":   .floatingPoint(Double(tof)),
        "h":     .floatingPoint(Double(h)),
        "bat":   .integer(bat),
        "baro":  .floatingPoint(Double(baro)),
        "time":  .floatingPoint(Double(time)),
        "agx":   .floatingPoint(Double(agx)),
        "agy":   .floatingPoint(Double(agy)),
        "agz":   .floatingPoint(Double(agz)),
        "marker": PlaygroundValue.dictionary([
            "id":   .integer(marker.id),
            "x":  .floatingPoint(Double(marker.x)),
            "y":  .floatingPoint(Double(marker.y)),
            "z":   .floatingPoint(Double(marker.z)),
        ]),
        "temp": PlaygroundValue.dictionary([
            "temph":   .integer(temp.temph),
            "templ":   .integer(temp.templ),
        ]),
        "mpry":PlaygroundValue.dictionary([
            "x":  .floatingPoint(Double(mpry.x)),
            "y":  .floatingPoint(Double(mpry.y)),
            "z":   .floatingPoint(Double(mpry.z)),
        ]),
        "sn": .string(sn),
    ]
    let value: PlaygroundValue = PlaygroundValue.dictionary(dict)
    return value
}

为变量指定数据类型可能会有所帮助:使用 let dict: [String: PlaygroundValue] = [...] 而不是 let dict: [:] = [...]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 编译器无法在合理时间内对该表达式进行类型检查 --> Xcode swift - The compiler is unable to type-check this expression in reasonable time --> Xcode swift SwiftUI 和编译器无法在合理的时间内对该表达式进行类型检查 - SwiftUI and The compiler is unable to type-check this expression in reasonable time 编译器无法在合理的时间内对该表达式进行类型检查 - The compiler is unable to type-check this expression in reasonable time 编译器无法在合理时间内对该表达式进行类型检查 SwiftUI - The Compiler is unable to type-check this expression in reasonable time SwiftUI 我的问题:编译器无法在合理的时间内对该表达式进行类型检查; - My problem: The compiler is unable to type-check this expression in reasonable time; 编译器无法在 SwiftUI 中的合理时间内对该表达式进行类型检查? - The compiler is unable to type-check this expression in a reasonable time in SwiftUI? SwiftUI:! [Array] 编译器无法在合理的时间内对该表达式进行类型检查 - SwiftUI:! [Array] the compiler is unable to type-check this expression in reasonable time “编译器无法在合理的时间内对这个表达式进行类型检查”一个简单的公式 - “The compiler is unable to type-check this expression in reasonable time” for a simple formula Xcode 编译器错误:编译器无法在合理的时间内对该表达式进行类型检查 (Xcode 12.0 SwiftUI) - Xcode Compiler error: The compiler is unable to type-check this expression in reasonable time (Xcode 12.0 SwiftUI) Xcode 12.0 12A7209 SwiftUI 错误:编译器无法在合理时间内对该表达式进行类型检查 - Xcode 12.0 12A7209 SwiftUI error: The compiler is unable to type-check this expression in reasonable time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM