I have two UIViewController in which the photos are displayed, the fact is that when I switch between them, then I add 50-70mb of RAM and so on ad infinitum.
'
var tags: [TagForRecipe] = [] // CoreData entity
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "tagCell", for: indexPath) as! TagsTableViewCell
cell.tags.text = tags[indexPath.row].nameTag
cell.images.image = UIImage(contentsOfFile: (tags[indexPath.row].image as! URL).path)
return cell
}
import UIKit
class TagsTableViewCell: UITableViewCell {
@IBOutlet weak var images: UIImageView!
@IBOutlet weak var tags: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
'