As in the TableView in the pressed cell in the resulLabel (the result of adding two numbers), assign the selected answer from the Nib/Xib file keyboard

 class ResultViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, KeyboardDelegate { var keyboardView = Keyboard() func keyWasTapped(character: String) { //Тут получаю цифру нажатой кнопки print("character \(character)") pressedResult = character } //Тут показываю View из Nib файла func keyboardWillShow() { keyboardView.frame = CGRect(x: 5, y: 600, width: self.view.frame.width, height: 600) UIView.animate(withDuration: 0.3, delay: 0.0, options: .curveEaseInOut, animations: { self.keyboardView.frame = CGRect(x: 5, y: 345, width: self.view.frame.width, height: 600) }, completion: nil) for i in self.keyboardView.buttons { i.addTarget(self, action: Selector(("keyWasTapped")), for: .touchUpInside) titleArray += [i.currentTitle!] } self.view.addSubview(keyboardView) isKeyboardEnable = true } func keyboardWillHide() { UIView.animate(withDuration: 0.3, delay: 0.0, options: .curveEaseInOut, animations: { self.keyboardView.frame = CGRect(x: 5, y: 600, width: self.view.frame.width, height: 600) }, completion: { finished in self.keyboardView.removeFromSuperview() self.isKeyboardEnable = false }) } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! TableViewCell cell.backgroundColor = UIColor.clear cell.alpha = 0.1 cell.firstNumLabel.text = String(oneArray[indexPath.row]) cell.secondNumLabel.text = String(twoArray[indexPath.row]) cell.backgroundColor = UIColor.white return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if isKeyboardEnable == false { let result = (resultArray[indexPath.row]) var temp = [Int]() temp += [result] for _ in 0...10 { let random = (Int(arc4random_uniform(82))) temp.insert(random, at: 1) } temp.shuffle() for _ in keyboardView.buttons { for i in 0 ..< temp.count { keyboardView.buttons[i].setTitle(String(temp[i]), for: .normal) } } NotificationCenter.default.post(name: NSNotification.Name(rawValue: "keyboardWillShow"), object: nil) } else { NotificationCenter.default.post(name: NSNotification.Name(rawValue: "keyboardWillHide"), object: nil) } } 

For clarity

enter image description here

    0