There is I am trying to download image from URL and save it to variable of model. But it's not setting the image. Inside setImage I saw that it's downloading some data. URL's are checked and working. But when I check it for nil it's showing "empty input", "empty output".
let inputImage = UIImageView()
    let outputImage = UIImageView()
    DispatchQueue.main.async {
        let inputURL = URL(string: "someURL")
        let outputURL = URL(string: "someURL")
        inputImage.kf.setImage(with: inputURL)
        outputImage.kf.setImage(with: outputURL)
    }
    let coreDataModel = CoreDataModel()
    
    if let inputImageData = inputImage.image?.pngData()
    {  cloudAnalysisModel.input_image = inputImageData  }
    else
    {  print("empty input")  }
    
    if let outputImageData = outputImage.image?.pngData()
    {  coreDataModel.output_image = outputImageData   }
    else
    {  print("empty output")  }
 
    