无法根据成员 'fractionLength' 推断上下文基础

Cannot infer contextual base in reference to member 'fractionLength'

我正在尝试关注这个 screencast on building an app for Apple Watch。我已将 Xcode 更新到 13.3,但我收到了一个错误,该错误未出现在截屏视频中。

Cannot infer contextual base in reference to member 'fractionLength'

Cannot infer contextual base in reference to member 'numeric'

Extra argument 'numberFormat' in call

Text(
    Measurement(
        value: 47,
        unit: UnitEnergy.kilocalories
    ).formatted(
        .measurement(
            width: .abbreviated,
            usage: .workout,
            numberFormat: .numeric(precision: .fractionLength(0))
            )
        )
    )

也许情况发生了变化。你可以试试这个:

Text(Measurement( value: 47, unit: UnitEnergy.kilocalories)
        .formatted(
            .measurement(
                width: .abbreviated,
                usage: .workout,
                numberFormatStyle: .number.precision(.fractionLength(0))
            )
        )
)