Как я могу передать данные с одного TableViewCell в другой TableViewCell (Parse)?


#1

У массив один.Сначала сделал детальное представление сцены через viewController,все работало.Было затруднение передачи данных.Сейчас Я сделал tableviewCell детальную сцену.Переход не менял. Вот мой код. override

    func prepare(for segue: UIStoryboardSegue, sender: Any?) {
            
            switch (segmentControl.selectedSegmentIndex) {
                
            
            case 0 :
                    if segue.identifier == "showSoccer" {
                       
                let destationViewController = segue.destination as! DetailSoccerTableViewController
                        if let indexPath = tableView.indexPathForSelectedRow {
                      let row = Int((soccerString.count-1)-indexPath.row)
                            
                        
                            destationViewController.detailSoccer = soccerString[row]
                       
                            
                        }
                }




class DetailSoccerTableViewController: UIViewController,UITableViewDelegate,UITableViewDataSource  {

    @IBOutlet weak var imageSoccer: UIImageView!
    @IBOutlet weak var tableView: UITableView!
    
    
   
    
    var detailSoccer: Soccer!
    
    var selectedSoccer = [Soccer]()
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        title = detailSoccer.detailTitleS
        
        tableView.tableFooterView = UIView(frame: .zero)
        tableView.estimatedRowHeight = 288
        tableView.rowHeight = UITableViewAutomaticDimension
        tableView.separatorStyle = .none
        tableView.delegate = self
        tableView.dataSource = self
        tableView.register(UINib(nibName:"SoccerTableViewCell",bundle:nil), forCellReuseIdentifier: "soccerCell")
        
   
        tableView.reloadData()
        loadMatchSoccer()
      
       
        // Do any additional setup after loading the view.
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        self.navigationController!.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
        self.navigationController?.navigationBar.shadowImage = UIImage()
        self.navigationController?.navigationBar.isTranslucent = true
        self.navigationController!.view.backgroundColor = UIColor.clear
        self.navigationController?.navigationBar.backgroundColor = UIColor.clear
        
        
    }
    
 
   
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }

    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    
        return selectedSoccer.count
    }
    

    
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let soccerCell = tableView.dequeueReusableCell(withIdentifier: "soccerCell", for: indexPath) as! SoccerTableViewCell
        
        let selectedSoccerRow = selectedSoccer[indexPath.row]
        switch indexPath.row {
        case 0:
            soccerCell.titlePrognoz.text = "Описание:"
            soccerCell.textSoccer.text = selectedSoccerRow.textSoccer
            
        case 1:
            soccerCell.titlePrognoz.text = "Прогноз на матч:"
            soccerCell.textSoccer.text = selectedSoccerRow.detailPrognozS
        default:
            break
        }
        
        
        return soccerCell
        
    }
    
    
   
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
    
    func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
    
    
    
    
    
   
    
    func loadMatchSoccer() {
        
        let query = Soccer.query() as! PFQuery<Soccer>
        
        
        query.findObjectsInBackground  { (objects, error) in
            if error == nil {
                
                self.selectedSoccer = objects!
                
                DispatchQueue.main.async(execute: {
                    self.tableView.reloadData()
                })
                
                
                
            } else {
                print(error!)
            }
        }
    }
    }

Раньше я использовал я соединения с ViewController
вот этот код , пример :

if let object = baskets {

        self.textBasket.text = object["detailTextB"] as? String
        self.prognozBasket.text = object["detailPrB"] as? String
        self.titleBasket.text = object["detailTitleB"] as? String
        let imageFile = object["detailImageB"] as? PFFile
        imageFile?.getDataInBackground() { (data:Data?, error:Error?)->Void in
            if error == nil {
                if let imageData = data {
                    self.imageBasket.image = UIImage(data: imageData)
                    
                
                    
                    
                }
                
            }
            
        }
    }    

Я разбил строку на два части, так вот при открытие у меня передается одно и тоже, хоть первую, вторую, третью строку открываю.Есть кто разбирается и сможет мне объяснить в чем я допускаю ошибку.Очень буду благодарен …