Data.write deprecated?

I assume the red strikeout lines in Xcode mean something has been deprecated?

Is there some other way to do this using writeData maybe?

Thanks…

I presume that the reason why there is a strikethrough when you type let _ = try? data.write(to: url, options: [.atomic]) is because write(to:options:) is a void method. Xcode sees that you’re typing out code to assign a value to _ so it puts a strikethrough to any void methods.

Alternatively, you can skip the throwaway declaration.

if let data = UIImageJPEGRepresentation(image, 0.5) {
  // Write it to full URL
  try? data.write(to: url, options: [.atomic])
}