iOS 16 deprecation of asset.duration

4.5k Views Asked by At

Using Xcode 14.0, iOS 16, Swift 5.7,

I get the following deprecation warning due to iOS 16:

'duration' was deprecated in iOS 16.0: Use load(.duration) instead

Here is my code:

var actualTime: CMTime = CMTimeMake(value: 0, timescale: asset.duration.timescale)

What do I need to change in order to get rid of this warning?

I tried:

var actualTime: CMTime = CMTimeMake(value: 0, timescale: asset.load(.duration).timescale)

But this makes everything async. Do I really need to go down that road?

1

There are 1 best solutions below

0
Timchang Wuyep On
let duration = try await asset.load(.duration)