How to compress data in swift 3?
问题 I have some files in file manager in Swift 3. I want to upload them, but when I will convert them into base 64, their size will be huge! so I want to compress the data before converting it into base 64. Here is my code for converting: for i in 0...(rows?.count)! - 1 { let filePath = filesurl[fileManagerViewController.selectedFileIndex[i]] do { let fileData = try Data.init(contentsOf: filePath) let fileStream:String = fileData.base64EncodedString(options: NSData.Base64EncodingOptions.init