0

I have a tableView with cells and inside every cell, we have cell.imageView?.image. My task - upload by URL directly to that cell.imageView?.image image from google drive! I have completed link with file id like https://docs.google.com/uc?id=FILE-ID

I've tried the code below, but 0 effects!

import Foundation

for name in filesShow {
        if name.name == i.textLabel?.text {
               i.detailTextLabel?.text = name.identifier

                            i.accessoryType = .checkmark

               i.imageView?.image = UIImage(url: 
URL(string: "https://docs.google.com/uc?id=\(name.identifier)"))
                            self.tableView.reloadData()
                            continue
                        }

extension UIImage {
convenience init?(url: URL?) {
    guard let url = url else { return nil }

    do {
        let data = try Data(contentsOf: url)
        self.init(data: data)
    } catch {
        print("Cannot load image from url: \(url) with error: \(error)")
        return nil
    }
}

}

Igor
  • 5
  • 1
  • 4

0 Answers0