I haven\'t seen any documentation on the topic, but that doesn\'t mean it doesn\'t exist.
In iOS 13 and macOS 10.15 or newer you can use the new compressed method of NSData:
let compressedData = try? NSData(data: data).compressed(using: .zlib)
Unfortunately this method hasn't been ported to Swift's native Data class, but NSData can be simply casted to Data by adding as Data after the above code line.