Value of type 'Measurement<UnitEnergy>' has no member 'formatted'

I have just decided I want to make a watch app and am trying to familiarize myself with Xcode and Swift. So I decided to follow the Workout app for watchOs tutorial and the tutorial used this block of code.

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

However when I try to use this code I get the following error.

Value of type 'Measurement<UnitEnergy>' has no member 'formatted'

Im using XCode Version 12.5.1

Any help is appreciated!

Value of type 'Measurement&lt;UnitEnergy&gt;' has no member 'formatted'
 
 
Q